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/StrutsManualActionWebComponent

------------------------------------------------------------------------------
  #format wiki
  #language en
  
- Struts 1.3.x (TBD) allows building portlet-like web components using JSP as 
view technology. The components work properly with or without Javascript 
enabled.
+ Struts 1.4 allows building portlet-like web components using JSP as view 
technology. The components work properly with or without Javascript enabled.
  
  Struts Components have the following features:
  
@@ -15, +15 @@

     * Ensures that every component renders itself independently.
     * Updates page incrementally without full page refresh if browser has 
Javascript turned on and XMLHTTPRequest is available.
     * Seamlessly integrates with Struts, enhancing a well-known action 
framework with component technology.
+ 
+ == Struts Component Lifecycle ==
+ 
+ ''Struts web component'' is an independent stateful server-side object that 
accepts user input via Action class, and renders itself via JSP file.
+ 
+ The component lifecycle is managed in a five-step process:
+ 
+    1. The cycle begins with the initial load of a composite page, starting 
the render phase.
+    2. When the JSP processor encounters a <c:import> action in a composite 
page, it generates an HTTP request to obtain the content of the included 
component.
+    3. The Action class forwards to a view relevant to component state. After 
all components on the composite page have rendered themselves, the render phase 
finishes and a composite page is presented to a user.
+    4. The user initiates the input phase by submitting an HTML form or by 
activating a command link. The browser sends input data to an Action that 
manages component events and state. The Action processes data and updates 
component state if needed. Component state can be stored in a session-scoped 
form bean, in a database or in other location.
+    5. After input data has been processed, the Action automatically redirects 
to location of the composite page, effectively switching from input phase back 
to render phase. Steps 1 through 3 are repeated, and an updated page is 
presented to the user.
+ 
+ If the browser has JavaScript turned on and the XMLHTTPRequest object is 
available, the component switches to Ajax mode by making an asynchronous 
request to update the component without full page refresh, so steps 5, 1, and 2 
are skipped, and step 4 jumps right to step 3. The incremental update is more 
effective in regards to network traffic and avoids the complexities of 
identifying the reload address.
+ 
+ A Struts component incorporated into a page looks and behaves uniformly 
whether it runs in Ajax mode or not. The dual-mode functionality of Struts web 
components is invaluable for environments where JavaScript is not allowed or in 
browsers that do not support the XMLHTTPRequest object, like some mobile 
browsers.
  
  == Use Case: Home Page With Login Component ==
  

Reply via email to