Figure 77 shows how we implemented this to process an HTML form.
METHOD=POST>
. . .
Figure 77. Invoking a servlet that will process a form
In our servlet, called AccessUserstuf, we indicate what action is to be taken
by adding a hidden parameter in the form. In Figure 77, this hidden parameter
is called action and indicates that this form will be processed as a login. This
action parameter indicates whether this is a login, update, registration, or
other action. This code allows us to code only one servlet to perform various
functions.
3.6.2.2 Generating dynamic HTML
The servlet, AccessUserstuf, with the hidden parameter set to login, verifies
that the user is valid. If an error occurs during this validation, the servlet has
to be able to communicate this back to the calling JSP. We chose to
implement HttpSession objects to enable maintaining the connection
information (see Section 3.5.2,  Maintaining state in HTTP  on page 81). The
servlet puts the information into the HttpSession object and calls a JSP file.
The JSP file then retrieves this information as follows:
  Create the session using HttpSession
  Use
getValue()
method to access information
Figure 78 illustrates this method
<% HttpSession session=request.getSession(true);
if (session.getValue("error") !=null){
%> ERROR:<%
out.println(session.
getValue("error"));
}
session.removeValue("error");
%>
Figure 78. Implementing the session object in a JSP
102
Linux Web Hosting with WebSphere, DB2, and Domino




  

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