Java Reference
In-Depth Information
Joe Asks. . .
Where Does ${actionBean} Come From?
This is a feature that Stripes provides—it sets the action bean
that has handled the current event as the “ actionBean ” request-
scope attribute. This means that in your JSPs, you can always
refer to the current action bean using ${actionBean} . From there,
you can access the action bean's properties using standard
EL expressions such as ${actionBean.date} . Because Stripes cre-
ates new instances of action beans for every request, it's quite
appropriate
to
store
request-related
values
in
action
bean
properties.
With more than one event handler and no @DefaultHandler annotation,
Stripes won't know which one is the default and will throw an exception.
In the example, @DefaultHandler is on currentDate ( ).
There's nothing wrong with using the @DefaultHandler annotation on an
event handler that happens to be the only one defined in an action
bean. In fact, consider it good practice, since it clearly marks the intent
and saves us from forgetting to specify it if we decide later to add other
event handlers to the action bean.
On the other hand, do not annotate more than one event handler with
@DefaultHandler in the same action bean—you'll get an exception.
After an event handler has done its work, it returns a resolution. What's
a resolution, besides something that people have at New Year's and
abandon a few weeks later?
Resolutions
A resolution tells Stripes what to do next in response to the current
request. An example of a resolution is to forward to a JSP, which is what
the event handlers of HelloActionBean do by returning a ForwardResolution
to /WEB-INF/jsp/hello.jsp .
In terms of actual code, Resolution is a one-method interface:
public interface Resolution {
void execute(HttpServletRequest request,
HttpServletResponse response)
throws Exception;
}
 
 
Search WWH ::




Custom Search