Learn Java for Web Development

(Tina Meador) #1
CHAPTER 4: Building a Web Application Using Struts 2 195

Listing 4-38 illustrates the web.xml file.


Listing 4-38. web.xml


1.<!DOCTYPE web-app PUBLIC



  1. "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

  2. "http://java.sun.com/dtd/web-app_2_3.dtd" >


  3. 5.
    6.Archetype Created Web Application
    7.
    8.org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
    9./WEB-INF/tiles.xml
    10.




  4. 12.
    13.struts2
    14.org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    15.

    16.
    17.struts2
    18./*
    19.

    20.
    21.org.apache.tiles.extras.complete.CompleteAutoloadTilesListener
    22.

    23.
    24.index.jsp
    25.




  5. 27.




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.

Free download pdf