Servlets.com

Home

What's New?

com.oreilly.servlet

Servlet Polls

Mailing Lists

List Archives

Servlet Engines

Servlet ISPs

Servlet Tools

Documentation

Online Articles

The Soapbox

"Java Servlet
Programming,
Second Edition"

"Java Enterprise
Best Practices"

Speaking & Slides

About Jason

XQuery Affiliate

Advertising Info

The Book
Chapter 18 Examples from Java Servlet Programming, 2nd Ed


Examples from other chapters:

Example 18.1: Saying "hello" with JSP
This shows a simple JSP page that says a personalized “Hello” using the predefined request and out variables.

Example 18.3: Saying "hello" using a JSP declaration
This shows a JSP page that uses a declaration to define the getName() method and an expression to print it.

Example 18.4 and 18.5: Born to be bad
This shows a JSP page that uses several directives. First it sets the page directive session attribute to false because the page doesn’t use the session object and there’s no need for the server to create a session needlessly. Then it sets the errorPage attribute to /errorTaker.jsp so if the page throws an uncaught exception the errorTaker.jsp page will handle the display of the error message. The body of the page throws an exception to trigger the errorPage behavior.

Example 18.6 and 18.7: Saying "hello" using a JavaBean
This example demonstrates the use of a JavaBeans component with a JSP page; it says “Hello” with the help of a HelloBean.

Example 18.8 to 18.11: A tool application using beans
This example shows how to use beans to write the tool view application shown in previous chapters. There's a bean embedded into the JSP page that gives the page access to the tool information and let the page act as the view onto that data.

Example 18.12 and 18.13: A tool application using custom tag libraries
This shows how to usethe <iterate> and <property> tags from Apache Struts to simplify the toolview.jsp page. This also demonstrates the servlet-driven Model 2 architecture in which a servlet receives the request, adds attributes to the request object, then dispatches the request to a JSP that acts like a template.

 


Home   com.oreilly.servlet   Polls   Lists   Archives
Engines   ISPs   Tools   Docs   Articles   Soapbox   Book

Copyright © 1999-2005 Jason Hunter
Privacy Policy

webmaster@servlets.com
Last updated: March 1, 2009