This action requires a valid username and password in HttpSession
object. It then delete the userverify entry and invalidates the HttpSession
object.
  order
This action requires a valid username, password in Session object, and
product_id in Request object. It then inserts the new order into userorders
table.
  listorders
This action requires a valid username and password in HttpSession
object. It then returns Orders object with a list of order_ids, associated
timestamps and product_ids.
The complete listing of the AccessUserstuf servlet code is available in
Appendix B.2,  Java servlet AccessUserstuf  on page 147. The complete
discussion of all the method performed in the servlet is out of the scope of the
book. We will demonstrate the detailed implementation of the login action in
Section 3.5.3.4,  AccessUserstuf action=login  on page 89. The discussion of
the listorders action is discussed with the Java bean discussion in Section
3.7,  Accessing data through a Java bean  on page 103.
3.5.3.4 AccessUserstuf action=login
The following sequence of tasks is performed when the servlet is invoked with
the action parameter that contains the value of login:
1. The login action expects the username and password parameters to be
set in the Request object and will access these parameters via the
getParameter method. Assuming there is a HttpServletRequest object
passed via variable
req
, the code to do this is as follows:
String username=req.getParameter( username );
String password=req.getParameter( password );
For our purposes, this code is reused often; hence, we code a
getUsername and getPassword private method to obtain these values.
The method for getUsername is coded as follows:
private String getUsername(HttpServletRequest req) {
return req.getParameter( username );
}
Hence, we change our code as follows:
String username=getUsername(req);
String password=getPassword(req);
Chapter 3. Building the Web server
89




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved