Java Reference
In-Depth Information
That's a lot of XML, but don't worry—you have to do this only once,
and then you can use this configuration as a base for every Stripes
application you write. You'll need only to edit web.xml to enable some of
Stripes' more advanced features, and even then it's the “once and for
all” type of configuration. You won't have to work with XML files—or
any other configuration files—for everyday work.
Here's what is now set up in this web.xml file:
Ê
The Stripes filter declaration.
Ë
A parameter to the Stripes filter. More details on this in a minute.
Ì
The dispatcher servlet declaration.
Í
A mapping to make the Stripes filter intercept all requests that go
through the dispatcher servlet.
Î
A mapping that makes the dispatcher servlet handle all . action
requests.
Ï
This says to use index.jsp as a default file when the user accesses
the application with the base URL, such as http://localhost:8080/
getting_started . We'll see how that works a little later.
Have a look at an illustration of this configuration in Figure 2.1 , on the
following page. All . action requests are intercepted by the Stripes filter
and then handled by the dispatcher servlet that looks for the action
bean that is bound to the URL. Stripes instantiates the action bean and
uses it to handle the request. The action bean can produce a response
directly or forward to a JSP, which in turn produces the response.
A value for the ActionResolver.Packages initialization parameter is given
to the Stripes filter in
Ë . As promised, let's take a closer look at what
this parameter does.
The Search for Action Beans
Action beans are the basic building blocks of a Stripes application.
Because they are so essential, Stripes automatically loads them at
startup by scanning the class path. But it does need a starting point:
at least one package root from which to begin the search. So, you must
choose the package(s) in which you'll be placing your action beans and
indicate the package roots, separated by commas, using the Stripes fil-
ter's ActionResolver.Packages initialization parameter. For each package
Specifying the Action-
Resolver.Packages para-
meter is mandatory.
root, Stripes will examine the classes in that package and all subpack-
ages. Every action bean that it finds will be registered.
 
 
Search WWH ::




Custom Search