Online Shopping
3.3.1. SELECTION OF LANGUAGE: Ideally software requirements should precipitate the selection of a language that is best fit to the processing functions to be carried out. By considering the requirements and different language features required in the design phase, the best-suited software could be selected The process, which is specified in the design phase, needs data structures, memory speed and efficiency, graphic support, control structures and file manipulation operations. The concept of modularity and module independence is mainly required for object oriented programming specifications like windows programming. 3.3.2. KEY FEATURES OF SERVLETS: Unlike CGI and FastCGI, which use multiple processes to handle separate requests, servlets are handled by separate threads within the web server. •
Servlets are efficient and scalable.
•
Servlets are portable across operating systems and across
•
server implementations.
•
Servlet invocation is highly efficient. Once a servlet is loaded,it generally remains in the server’s memory as a single object instance.
•
Servlet code is clean, object oriented, modular, and amazingly simple.
48 Dept of C.S.E. Narayana Engineering College., Nellore.
Online Shopping
•
Servlets can handle errors safely, due to Java’s exception-handling mechanism.
•
Servlets are also quite flexible and easily extensible. 3.3.3. CODING STANDARDS: Code documentation: While concerning the procedural design language specified
in
the
design
phase for each module, the
code
documentation, the identifier naming is done meaningfully for the ease of understanding. The related data names with the remarks are specified in each module of the project. Data declaration: The different types of data are declared namely integer, real, char and long integer data types, which are needed for the huge data streams processing. Statement constructs: The statement constructs used are sequence, conditions and looping. For each construct the coding is done as a block of statements for easy understanding, for the complex arithmetic statements the parentheses are used.
49 Dept of C.S.E. Narayana Engineering College., Nellore.
Online Shopping
3.3.4 PSUEDO CODE OF MODULES: The screens used in this project are developed using HTML. Various Text fields, buttons, forms and a display are used in the development process.
1. Login Screen In the coding of the screens various Java packages has been imported. import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import java.lang.String.*; import java.util.*; import util.StringTokenizer.*; Servlets use classes and interfaces from two packages javax.servlt and javax.servlet.http.The javax.servlet contain classes to support generic, protocol-independent servlets. Every
servlet
must
implement
the
javax.servlet.Servlet
interface. Most servlets implement it by extending one of two special classes:javax.servlet.GenericServlet or javax.servlet.HttpServlet. public class Sample extends Httpservlet 50 Dept of C.S.E. Narayana Engineering College., Nellore.
Online Shopping
{ public void doGet (HttpServletRequest req, HttpServletREsponse res) throws servletException, IOException {
Any servlet uses the setContentType () method of the response object to set the content type of its response to “text/html”, the standard MIME content type for HTML pages. Then, it uses the get Writer() method to retrieve a print-Writer, the international-friendly counterpart to a printStream. When a client connects to a server and makes an HTTP request, the request can be of several different types, called methods. The more frequently used methods are GET and POST. The Get method is designed for getting information, while the POST method is designed for posting information. A servlet can identity the user through her username and thereby track her session. String sessionid=req.getpathInfo(); If(sessionid==null) { sessionid=user_id; } For the first time the sessionid is null, so we are generating the sessionid as user_id. The sessionid is passed to the next servlet as:
51 Dept of C.S.E. Narayana Engineering College., Nellore.
Online Shopping
out.println("