In ActionClass we can use only one action i.e execute(), but
in DispatchAction we can use multiple actions.My question is
, we can use multiple actions in Action class
if(action.equals("add") if(action.equals("update"). Then
when to use Action and DispatchAction which is frequently
in webapplications.

Answer Posted / shirish

DispatchAction is generally used when we need to group a set
of actions. E.g. addDepartment, editDepartment,
updateDepartment, deleteDepartment. The method to be called
is identified on the basis of a parameter which can be
configured in struts-config.com (action tag). The parameter
is usually passed from the JSP and is automatically mapped
to the action parameter (defined in action tag in
struts-config.xml). Also we need to add an attribute with
name same as the parameter name to the corresponding ActionForm

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do I have to credit struts on my own website?

528


What is the default suffix for Struts2 action URI and how can we change it?

512


What is the use of reset method of ActionForm class?

565


Can you explain struts.properties in struts2?

521


How do I access token?

489






What are the various struts tag libraries?

537


What are the core classes of the struts framework?

506


What are the two different types of validations that the validator framework supports?

515


What is action chaining ?

620


Which model components are supported by Struts?

561


What is the purpose of '@keyproperty'?

567


What is the purpose of @action annotation?

562


Explain about the future of struts?

528


What is struts-default package and what are it’s benefits?

566


What do you mean by the abstract package in struts2, and what is its utilization?

504