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

------------------------------------------------------------------------------
  
  Action class provides only one method to deal with all incoming requests, 
therefore actions rarely distinguish a ''render request'' from a ''submit 
request''. This often leads to convoluted and unmaintable code that can break 
from an occasional page refresh or from clicking on a Back button.
  
+ inline:setup_submit.gif
+ 
  Despite its shortcomins, the "servlet mode" is one of more popular uses of 
Action class.A typical Action class will often implement logic like the 
following in its execute method:
  
      * Validate the current state of the user's session (for example, checking 
that the user has successfully logged on). If the Action class finds that no 
logon exists, the request can be forwarded to the presentation page that 
displays the username and password prompts for logging on. This could occur 
because a user tried to enter an application "in the middle" (say, from a 
bookmark), or because the session has timed out, and the servlet container 
created a new one.
@@ -30, +32 @@

      * Perform the processing required to deal with this request (such as 
saving a row into a database). This can be done by logic code embedded within 
the Action class itself, but should generally be performed by calling an 
appropriate method of a business logic bean.
      * Update the server-side objects that will be used to create the next 
page of the user interface (typically request scope or session scope beans, 
depending on how long you need to keep these items available).
      * Return an appropriate ActionForward object that identifies the 
presentation page to be used to generate this response, based on the newly 
updated beans. Typically, you will acquire a reference to such an object by 
calling findForward on either the ActionMapping object you received (if you are 
using a logical name local to this mapping), or on the controller servlet 
itself (if you are using a logical name global to the application).
- 
- In Apache Struts 1.0, Actions called a perform method instead of the 
now-preferred execute method. These methods use the same parameters and differ 
only in which exceptions they throw. The elder perform method throws 
SerlvetException and IOException. The new execute method simply throws 
Exception. The change was to facilitate the Declarative Exception handling 
feature introduced in Apache Struts 1.1.
- 
- The perform method may still be used in Apache Struts 1.1 but is deprecated. 
The Apache Struts 1.1 method simply calls the new execute method and wraps any 
Exception thrown as a ServletException. The deprecated perform method was 
removed in Apache Struts 1.2.
  
  == Action As A Behavior Object ==
  

Reply via email to