If the
session.getValue()
returns a null string, the error and an explanation is
then printed to the client browser using
out.println()
. The error keyword is
then removed from the session information.
In general, all the information that is passed to our JSP files from the servlet
has been implemented using the HttpSession object. Figure 79 illustrates
how this was achieved in our home page.
<% if (session.getValue("as400")!=null) {%>
AS/400
<% }%>
Figure 79. Retrieving information from the session object
In Figure 79, we used the information contained in the HttpSession to
dynamically generate a link to a new servlet. If the  value  returned by
session.getValue()
contains a null string, the link to
/servlet/VBDList10?as400=item1
would not be displayed in the home page.
3.7 Accessing data through a Java bean
Java beans are Java components designed to be used on client systems. They
are Java classes that conform to certain coding standards. They can be
described in terms of their properties, methods, and events. Java beans may be
packaged with a special descriptor class called a BeanInfo class and special
property editor classes in a JAR file. Java beans may or may not be visual
components. For more information, see the Java bean documentation at:
http://www.javasoft.com/beans/docs
A bean was chosen for one instance where the database was queried for
information pertaining to previous orders. We create the following coding
construct to access a bean for the list of orders:
  A bean is called from within a JSP by using the
tags.
The JSP can then access the values contained within the bean using the
request object. Figure 80 on page 104 illustrates how we accomplished
this.
Chapter 3. Building the Web server
103




  

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