D
Darrin
OK, I'm inside the execute method of an Action class and want to do a
findForward for the name="next". Just what name="next" will be
returned?
In other words, how do I map to the right action?
Example:
public final class WizardAction extends AbstActionBase
{
private Log log = LogFactory.getLog(this.getClass().getName());
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
Locale locale = getLocale(request);
MessageResources messages = getResources();
//Create our errors collection
ActionErrors errors = new ActionErrors();
//Retrieve our form instance (derived from ActionForm)
WizardForm wizardForm = (WizardForm) form;
if (wizardForm.getCurrentStep().equals("1") &&
(wizardForm.getAction().equals(messages.getMessage("button.next"))))
{
wizardForm.setCurrentStep("2");
return (mapping.findForward("next")); <--This is the next
}
Now for a couple of the actions found in the struts-config.xml file:
<action path="/wizard"
type="cdmanager.actions.WizardAction"
name="wizardForm"
scope="request"
validate="true"
input="/wizard.jsp">
<forward name="next" path="/wizard.jsp"/>
<forward name="success" path="/wizarddone.jsp"/>
</action>
<action path="/another"
type="cdmanager.actions.AnotherAction"
name="anotherForm"
scope="request"
validate="true"
input="/another.jsp">
<forward name="next" path="/another.jsp"/>
<forward name="success" path="/anotherdone.jsp"/>
</action>
So how do I know when the findForward is done which one (another.jsp
or wizard.jsp) I will get back?
I don't see how it is mapped. I know that the type is held in the
action (cdmanager.actions.WizardAction) but what if I wanted to use
the "Another" action instead of "Wizard" action?
Just how does the mapping occur?
THANKS!!!!!!
findForward for the name="next". Just what name="next" will be
returned?
In other words, how do I map to the right action?
Example:
public final class WizardAction extends AbstActionBase
{
private Log log = LogFactory.getLog(this.getClass().getName());
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
Locale locale = getLocale(request);
MessageResources messages = getResources();
//Create our errors collection
ActionErrors errors = new ActionErrors();
//Retrieve our form instance (derived from ActionForm)
WizardForm wizardForm = (WizardForm) form;
if (wizardForm.getCurrentStep().equals("1") &&
(wizardForm.getAction().equals(messages.getMessage("button.next"))))
{
wizardForm.setCurrentStep("2");
return (mapping.findForward("next")); <--This is the next
}
Now for a couple of the actions found in the struts-config.xml file:
<action path="/wizard"
type="cdmanager.actions.WizardAction"
name="wizardForm"
scope="request"
validate="true"
input="/wizard.jsp">
<forward name="next" path="/wizard.jsp"/>
<forward name="success" path="/wizarddone.jsp"/>
</action>
<action path="/another"
type="cdmanager.actions.AnotherAction"
name="anotherForm"
scope="request"
validate="true"
input="/another.jsp">
<forward name="next" path="/another.jsp"/>
<forward name="success" path="/anotherdone.jsp"/>
</action>
So how do I know when the findForward is done which one (another.jsp
or wizard.jsp) I will get back?
I don't see how it is mapped. I know that the type is held in the
action (cdmanager.actions.WizardAction) but what if I wanted to use
the "Another" action instead of "Wizard" action?
Just how does the mapping occur?
THANKS!!!!!!