Java Reference
In-Depth Information
Listing 4-38 illustrates the web.xml file.
Listing 4-38. web.xml
1.<!DOCTYPE web-app PUBLIC
2. "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3. " http://java.sun.com/dtd/web-app_2_3.dtd " >
4.
5.<web-app>
6.<display-name>Archetype Created Web Application</display-name>
7.<context-param>
8.<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
9.<param-value>/WEB-INF/tiles.xml</param-value>
10.</context-param>
11.
12.<filter>
13.<filter-name>struts2</filter-name>
14.<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
15.</filter>
16.<filter-mapping>
17.<filter-name>struts2</filter-name>
18.<url-pattern>/*</url-pattern>
19.</filter-mapping>
20.<listener>
21.<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
22.</listener>
23.<welcome-file-list>
24.<welcome-file>index.jsp</welcome-file>
25.</welcome-file-list>
26.
27.</web-app>
Lines 7 to 10 and lines 21 to 22 are required to configure Tiles with Struts 2.
Integrating the Data Access Layer
In this section, you will integrate the web application you created with the data access layer. You
can use the data access layer you created in Chapter 1. You will then authenticate the user against
the database. Next, you will show the categories in the bookstore database on the menu bar. Then
you will retrieve the list of books from the database by category. Figure 4-23 illustrates the directory
structure of the application.
 
Search WWH ::




Custom Search