Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change 
notification.

The following page has been changed by MichaelJouravlev:
http://wiki.apache.org/struts/StrutsManualActionClasses

------------------------------------------------------------------------------
  !ActionForward object usually designate another Action (see 
[:ActionChaining:action chaining]) or a presentation page (illustrated below). 
Struts is agnostic to presentation technology, so response can be generated 
from JSP file, Tile definition, Velocity template, XSLT stylesheet or other 
source.
  
  inline:basic_action.gif
+ 
+ !ActionForward object represents a logical outcome of processing a request. 
By not defining a specific menu choice or a page URL it is possible to separate 
state of a resource from its visual representation.
+ 
+ '''Example'''
+ 
+ Consider the Action that performs a search. The author of this code should 
not care about how the search results are presented, his only job is to say 
"what happened" when the search took place.
+ 
+ Logically, there are three interesting outcomes we might want to describe:
+  * No results at all were found => outcome "none".
+  * Exactly one result was found => outcome "single".
+  * More than one result was found => outcome "multiple".
+ 
+ The search Action should return these three results as three separate logical 
outcomes. It is up to the application architect to decide to send all three 
outcomes to the "here's the list of responses" table page. It's also up to the 
application architect (perhaps later, in response to user feedback) to say 
"let's do this instead":
+ 
+  * If there's no results, go to a page that says "sorry, no results were 
found, please try your search again."
+  * If there's exactly one response, go to the details page to display the 
corresponding data.
+  * If there's more than one response, go to the list page (as per the 
previous behavior).
+ 
+ Note that the code of the search action is not affected by this decision. The 
outcomes returned by an action are much more stable than the target locations.
  
  == Action As Simple Service ==
  In its simplest form Action class handles all incoming requests with one 
callback method, {{{execute()}}}. Two overloaded versions of this method are 
available. Choosing one or another depends on your servlet environment. A 
non-HTTP execute() method has been provided for applications that are not 
specifically geared towards the HTTP protocol, but most projects will only use 
the HTTP version since the majority of teams using the framework are focused on 
building web applications:

Reply via email to