Java Reference
In-Depth Information
■
ibatis-sqlmap-2.jar
■
jakarta-oro.jar
■
struts.jar
With this basic source tree structure in place, let's move on to coding our working
application. Since the catalog portion of the application is the first one that a cus-
tomer views, let's concentrate our efforts there.
14.5 Configuring the web.xml
Setting up
web.xml
is pretty straightforward. We will set up our Struts
ActionServlet
and some simple security to prevent direct access to the
JSP
pages (see listing 14.1).
Listing 14.1
ActionServlet configuration in web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
When setting up the
ActionServlet
to process requests, we do so with the
<serv-
let>
tag. The settings for the
ActionServlet
are plain-vanilla Struts—nothing
fancy. The
ActionServlet
specified in the
<servlet-class>
tag is the standard
ActionServlet
. We provide a standard
struts-config.xml
location, a debug level
of 2, a detail level of 2, and a
load-on-startup
setting of 2.










