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

------------------------------------------------------------------------------
- The goal of an Action class is to process a request and return an 
ActionForward object. Action class can either implement a ''stateless service'' 
like "search", or can manage a logical ''web resource'' like "Customer".
+ The goal of an Action class is to either implement a stateless ''service'' 
like "Search", or to manage a stateful ''business object'' like "Customer".
  
- !ActionForward object identifies where control should be transferred to 
provide the appropriate response, and usually designates either another Action 
(see [:ActionChaining:action chaining]) or a presentation page. Struts is 
agnostic to presentation technology, so response can be generated using JSP 
file, Tile definition, Velocity template, XSLT stylesheet or other rendering 
engine.
+ An Action class handles a request and returns an !ActionForward object, which 
represents a logical outcome of processing a request. An action mapping in 
{{{struts-config.xml}}} file associates !ActionForward object with another 
Action (see [:ActionChaining:action chaining]), or with a presentation page or 
with any arbitrary URL.  By not defining a specific menu choice or a page URL 
in Java code it is possible to separate logical state of a ''web resource'' 
from its visual representation.
  
- !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.
+ Struts is agnostic to presentation technology, so response can be generated 
using JSP file, Tile definition, Velocity template, XSLT stylesheet or other 
rendering engine.
  
  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:
  
@@ -26, +26 @@

  
  Consider the Action that performs a search. The author of this code should 
not bother neither about how exactly the search criteria is obtained, nor about 
how the search results are presented. His only job is to say "what happened" 
after the search took place.
  
- Logically, there are three interesting outcomes:
+ There are three interesting outcomes:
   * No results were found => outcome "none".
   * Exactly one result was found => outcome "single".
   * More than one result was found => outcome "multiple".
@@ -41, +41 @@

  
  == Using Action To Display A Web Page ==
  
- You might be wondering now, how does an Action class obtain input and render 
output in a real-life application. Let us start with output, like creating a 
read-only page that prints out current time.
+ JSP is a default view technology used when developing with Struts. JSP file 
creates dynamic web content by reading information from various Java beans 
floating around in page, request, session or application scope. In a Model 1 
application these beans are put into scope by the code that resides in JSP page 
itself.
  
- JSP is a default view technology used when developing with Struts. JSP 
creates dynamic web content by reading information from various Java beans 
floating around in page, request, session or application scope. In a Model 1 
application these beans are put into scope by the code that resides in JSP page 
itself.
- 
- A standard practice to display a dynamic page in a Struts application is to 
use Action class "in front" of a JSP page. Action class creates needed beans, 
puts them in an appropriate context, and forwards control to a JSP page that 
reads information from these beans and displays it. Action class has access to 
all contexts available from JSP page except PageContext. In a simple case such 
''setup action'' does not have to accept parameters, its only purpose is to 
prepare output data for rendering.
+ A standard practice to display a dynamic page in a Struts application is to 
use Action class "in front" of a JSP page. Action class creates needed beans, 
puts them in an appropriate context, and forwards control to a JSP page that 
reads information from these beans and displays it. Action class has access to 
all contexts available to JSP page except !PageContext.
  
  The following picture illustrates a "render page" use case implemented with 
Struts and ASP.NET.
  

Reply via email to