Chapter 5 Client Design
227
5.3.5 Processing Return Values
J2EE applications generally use Web components to generate returned data for dis
play. For example, a client accessing an order tracking service might display track
ing information in a Web page using an HTML browser. The J2EE component may
take the values returned from the Web service and handle them just like any other
Java object. For example, a Web component in a J2EE client application might
query the status of an order from an order tracking service, which returns these
values within a JavaBeans like object. The client component places the returned
object in the request scope and uses a JSP to display its contents. (See Code
Example 5.9.)
Order ID: ${bean.orderId}
Status: ${bean.status}
Name: ${bean.givenName} ${bean.familyName}
Code Example 5.9
JSP for Generating an HTML Document
The J2EE platform has a rich set of component technologies for generating
Web content, including JavaServer Pages (JSP) technology for generating HTML
content and Java Standard Tag Libraries (JSTL). JSTL is a set of tags that assist a
client developer in formatting JSPs. For example, JSTL provides additional tags
for looping, database access, object access, and XSLT stylesheet transformations.
The current version of JSP (2.0), along with future versions, provides an expres
sion language that allows a developer to access bean properties. Together, devel
opers can use JSTL and JSP technologies to generate HTML documents from data
retrieved from a service. For example, a developer might generate the following
HTML document for the order details (see Code Example 5.10). This HTML doc
ument is returned to the HTML browser client that requested the service.
Order: 54321
Status: SHIPPED
New Page 1