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 that identifies where control should be transferred (e.g. a JSP page, Tile definition, Velocity template, or another Action) to provide the appropriate response. - == Action As A Servlet == + == Action As Simple Service == When used in "servlet mode", an Action class handles all incoming requests in one callback method, execute(). Two 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: @@ -33, +33 @@ * 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). - == Action As A Behavior Object == + == Action As Event Dispatcher == Behavior object handles a group of related messages (events, commands). These messages often correspond to one business object, like classic Create, Retrieve, Update and Delete messages that identify basic operations on persistent objects in a database-driven application. Behavior object usually changes application state based on incoming message. Application state can be stored in database, flat file or in a scoped object like !HttpSession or !HttpServletRequest. @@ -57, +57 @@ Behavior Actions usually handle submit requests only. To display a view they transfer control to a rendering Action. Thus the task of handling input and output is split into separate Actions. - == Action As Web Resource == + == Action As Web Resource Manager == inline:web_resource.gif - == Action As Stateful Web Resource == + == Action As Stateful Web Resource Manager == In Microsoft parlance, a code-behind class implements the logic of one web resource. Since ASP.Net uses Page Controller paradigm, a web resource is usually a page. Struts web resources are not constrained by one page, one resource can have several corresponding views defined in one or in several JSP files. @@ -70, +70 @@ * handles different commands and events corresponding to a web resource (submit phase), and * selects an appropriate view based on current state of web resource (render phase). - inline:action_code_behind.gif + inline:stateful_web_resource.gif {{{<action path = "/login" type = "samples.login.LoginAction" @@ -83, +83 @@ <forward name = "loggedin" path = "/logout.jsp" /> </action>}}} - == Action As A Web Component == + == Action As Web Component Manager == A web component differs from a web resource in that a component is visually a part of a larger ''composite page''. As such a web component does not need to navigate to a next location. Instead, a web component must either update itself on a composite page in place or reload the whole page after the component updated its state. In-place updating is facilitated using Javascript/XMLHttpRequest (Ajax mode), while full page reload is used if Javascript is turned off on a browser.