Datasheet

Patrick c01.tex V3 - 09/18/2009 12:15pm Page 22
Chapter 1: Building Web Applications in WebLogic
Table 1-5: Custom Tag Sources
Location Description
http://jakarta.apache.org/taglibs
This source has a number of open source tag
libraries, providing everything from string
manipulation to regular expression handling to
database access. It also hosts an implementation of
the JSTL specification.
http://jakarta.apache.org/struts
Struts is a model-view-controller framework that
includes a number of useful tag libraries.
http://www.servletsuite.com/jsp.htm
This commercial vendor, with more than 350
different tag libraries, offers free binary download
and evaluation.
In additional to the standard JSTL tag libraries packaged in WebLogic Server, useful tag libraries are
available from various vendors and open source communities. Table 1-5 provides a short list to get you
started in your search.
We will be using selected custom tags from the Spring MVC framework in the example application
in Chapters 3 and 4 to create HTML form elements with automatic handling of posted data during
processing.
Use Servlet Filtering for Common Behaviors
Servlet filtering, a feature of servlets introduced in the Servlet 2.3 specification, provides a declarative
technique for intercepting HTTP requests and performing any desired preprocessing or conditional
logic before the request is passed on to the final target JSP page or servlet. Filters are very useful for
implementing common behaviors such as caching page output, logging page requests, providing debug-
ging information during testing, and checking security information and forwarding to login pages.
Figure 1-2 illustrates the basic components of the filtering approach and shows the incoming HTTP
request passing through one or more
Filter
classes in the
FilterChain
collection defined for this
page request.
Filter Chain
Servlet
Filter 1
HTTP Request
HTTP Response
Filter 2
Figure 1-2: Servlet filtering.
Placing a filter in the path of a particular servlet or JSP request is a simple two-step process: Build a class
that implements the
javax.servlet.Filter
interface, and register that class as a filter for the desired
22