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

------------------------------------------------------------------------------
  
  !ActionForm should be populated only on submit phase. To protect !ActionForm 
from unintended modification by setup action, do not set "name" attribute in 
setup action mapping. This will prevent Struts from instantiating and 
populating the !ActionForm. To setup !ActionForm data you need to instantiate 
it yourself and to put in into appropriate scope, either into request or into 
session. You will also have to refer to the !ActionForm explicitly using "name" 
attribute of your input elements.
  
- == Step 6: Consolidate your actions; use DispatchAction flavor for submit 
action ==
+ == Step 6: Consolidate your actions; use DispatchAction flavor or action 
dispatcher for submit action ==
  
  A simple web resource like {{{Customer}}} can have couple of setup action 
mappings like {{{viewCustomer.do}}} and {{{editCustomer.do}}} and several 
submit action mappings like {{{addCustomer.do}}}, {{{updateCustomer.do}}} and 
{{{deleteCustomer.do}}}.  Of course, this does not mean that you need to define 
five corresponding Java classes. It would be great if you could reduce number 
of action classes down to two: one setup action and one submit action per web 
resource. It would be also great to reduce number of action mappings in 
struts-config.xml file.
  
@@ -98, +98 @@

   * !LookupDispatchAction is heavy, uses inverted reference to resource files.
   * !MappingDispatchAction can be used to dispatch only one method.
  
- Therefore I recommend using ActionDispatcher to dispatch events to any 
arbitrary action class.
+ Therefore I recommend using EventActionDispatcher to dispatch events to any 
arbitrary action class.
  
  == Step 7: Reduce number of actions down to one ==
  
- !ParameterMappingDispatchAction mentioned in the previous section, is pretty 
smart. It can detect the logical type of request that it receives: is it a 
render request or submit request. It does this by looking for event in the 
request. 
+ EventActionDispatcher mentioned in the previous section, is pretty smart. It 
can detect the logical type of request that it receives: is it a render request 
or submit request. It does this by looking for event in the request. 
  
+ If !EventActionDispatcher finds event in the request, it calls the 
corresponding method handler. This is a submit phase. If dispatcher cannot find 
event in the request, it calls default method. This request is supposed to 
belong to render phase, so you can prepare the !ActionForm and render a page.
- If !ParameterMappingDispatchAction finds event in the request, it calls the 
corresponding method handler. This is a submit phase. 
- 
- If !ParameterMappingDispatchAction cannot find event in the request, it calls 
default method. This is a render phase, so you can prepare the !ActionForm and 
render a page.
  
  inline:setup_submit_05.gif
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to