Java Reference
In-Depth Information
requests through the Struts controller (
ActionServlet
). To get people into that
initial page by passing through the Struts framework, we must create a simple
index.jsp
with a forward, define the
URL
we are forwarding to in the
struts-con-
fig.xml
file, define the tile in the
tiles-defs.xml
file, and create the initial
JSP
page our visitors will be arriving at.
In order for the
JSP
forward to work, we first need to set up the initial page
(figure 14.2) for our visitors.
This page will be located in the
web/catalog/
directory of our source tree and
will be named
Main.jsp
. Since the catalog is the first thing a visitor will view, we'll
place our main page in the catalog directory.
In addition, we will need to drop a definition for the page in the
tiles-
defs.xml
file (listing 14.3). Tiles make it easier to create common templates and
reuse them, thus avoiding the redundant
JSP
includes. To learn more about tiles,
check out
Struts in Action
.
Figure 14.2
The Main.jsp page is the first page a visitor will view.
