Struts Request Processing Overview
With power comes complexity, unfortunately. Before jumping into the details, here’s a brief summary of the parts of Struts I use for the Project Billboard application.
The Struts servlet delegates the real processing of requests to
classes that extends the Struts Action class. The
main method in this class is the perform( )
method. For each type of request the application supports, you create
a separate action class and provide the code for processing this
request type in the perform( ) method. Figure 19-3 shows the action classes used by the Project
Billboard application.
![]() |
The Struts servlet uses parts of the request URI to figure out which
type of request it is, locates the corresponding action class (using
configuration information), and invokes the perform(
) method. Note that this method doesn’t
render a response; it takes care of business logic only, for
instance, updating a database. The perform( )
method returns a Struts ActionForward instance,
containing information about the JSP page that should be invoked to
render the response. The page is identified by a logical name
(errorPage, mainPage, etc.),
mapped to the real page path in a configuration file. The page flow
can therefore be controlled, at least to some extent, by
reconfiguration instead of code changes.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
