background image

The Flow of a Request

<< What Is a Custom Tag | Configuring the Example >>
<< What Is a Custom Tag | Configuring the Example >>

The Flow of a Request

Figure 8­1
shows the flow of a request through the following Duke's Bookstore web
components:
tut-install/javaeetutorial5/examples/web/bookstore3/web/template/template.jsp,
which determines the structure of each screen. It uses the insert tag to compose a screen
from subcomponents.
tut-install/javaeetutorial5/examples/web/bookstore3/web/template/screendefinitions.jspf,
which defines the subcomponents used by each screen. All screens have the same banner but
different title and body content (specified by the JSP Pages column in
Figure 5­1
).
tut-install/javaeetutorial5/examples/web/bookstore3/src/java/com/sun/bookstore3/dispatcher/Dispatche
a servlet, which processes requests and forwards to template.jsp.
The source code for the Duke's Bookstore application is located in the
tut-install/javaeetutorial5/examples/web/bookstore3/ directory created when you unzip
the tutorial bundle (see
Chapter 2, "Using the Tutorial Examples"
).
To deploy and run the application using NetBeans IDE, follow these steps:
1. Perform all the operations described in
"Accessing Databases from Web Applications" on
page 97
.
2. In NetBeans IDE, select File
Open Project.
3. In the Open Project dialog, navigate to:
tut-install/javaeetutorial5/examples/web/
4. Select the bookstore3 folder.
5. Select the Open as Main Project check box and the Open Required Projects check box.
Web
Client
BookDB
Dispatcher
Servlet
HttpServlet
Request
Template
JSP Page
HttpServlet
Response
Web Container
BookDB
Catalog
JSP Page
HTTP
Request
HTTP
Response
1.
2.
3.
4.
5.
FIGURE 8­1
Request Flow through Duke's Bookstore Components
The Example JSP Pages
Chapter 8 · Custom Tags in JSP Pages
227