struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <>
Subject Re: Must everything go through an action?...
Date Sun, 05 Oct 2003 12:16:55 GMT
The current trend is to define two sets of Actions. One set represents 
the business actions, the client stories. This Action interacts with the 
business layer and, based on what happens, selects the next View. Back 
in the Struts 0.5 days, the ActionForward would often points to a server 
page, so the Action would, essentially, forward directly to a JSP.

Most of us now find it convenient to create a second set of "View" 
Actions. These Actions work as "page controllers". Instead of forwarding 
to the JSP, we forward to these Actions instead. These Actions can then 
prepare the request with whatever "chrome" the page may need.

It's a good practice to define an ActionMapping for every presentation 
page in the application, whether it's a server page or HTML, local or 
remote, even if it just forwards out to a page. If you need to add an 
Action class later, or switch in a server page for a static page, you 
can do that without changing anything else.

In Strut 1.1, I find it useful to separate the business Actions and the 
view Actions into separate configuration files, and may give the View 
Actions their own virtual path. So there might be a /SelectPermitAction 
and a /view/SelectPermitAction.

There is talk of adding a specific extension point for a "view Action" 
as part of the ActionForward construct, but AFAIK, no one's rolled up 
their sleeves and given it a try. This would save a trip through the 
container, and simplify cases where you want to redirect to another 
business Action.

HTH, Ted.

Keith Pemberton wrote:
> Experts,
>     I'm struggling with using the View Helper pattern.  In my logical way of
> thinking, when a request to any jsp page is made, then the request goes to
> the ActionServlet.  The ActionServlet then looks up the appropriate view
> helper initiallizes it with any parameters that were passed in through the
> request.  The ActionServlet then requests that the view helper put the
> required java bean object in the request scope and then the servlet forwards
> to the page that was requested.  This doesn't seem to be the case, though,
> with how struts works.  Please correct me if I am wrong, but every link in
> my jsp pages where the page that I am requesting has content that comes from
> a java bean (form bean) must be linked to some action component.  So, just
> say that I have an index page where I am displaying only five items at a
> time out of database that are ranked based on their index number in the
> database.  To get the next five entries from the database I would have to
> use the struts tags and put an html:link element in the page that pointed to
> some action class.  I, guess, am just looking for an assurance that I am
> implementing the view helper pattern the correct way according to struts.
> Any help you can provide would be much appreciated!
> Keith Pemberton
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Ted Husted,
   Junit in Action  - <>,
   Struts in Action - <>,
   JSP Site Design  - <>.

"Get Ready, We're Moving Out!!" - <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message