You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by billintx <bi...@gmail.com> on 2006/07/18 22:00:11 UTC

Forward to different Form/JSP from one action

I'd like to do something like this:

<action path="/edit" type="com.ni.apps.nispecs.actions.EditAction" 
input="/pages/selectTemplate.jsp">
   <forward name="template1" path="/jsp/editTemplate1.jsp" />
   <forward name="template2" path="/jsp/editTemplate2.jsp" />
   <forward name="template3" path="/jsp/editTemplate3.jsp" />
</action>

Each template would require a different ActionForm?

Should I create and put the ActionForm in the request manually?

Should I chain this with another action, so i'd have <forward name="template1" 
path="/editTemplate1.do" /> , where editTemplate1 action has the correct 
ActionForm?

Any other ideas?

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Forward to different Form/JSP from one action

Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/18/06, billintx <bi...@gmail.com> wrote:
> I'd like to do something like this:
>
> <action path="/edit" type="com.ni.apps.nispecs.actions.EditAction"
> input="/pages/selectTemplate.jsp">
>    <forward name="template1" path="/jsp/editTemplate1.jsp" />
>    <forward name="template2" path="/jsp/editTemplate2.jsp" />
>    <forward name="template3" path="/jsp/editTemplate3.jsp" />
> </action>
>
> Each template would require a different ActionForm?

Depends on your design. Generally, no.

> Should I create and put the ActionForm in the request manually?

As you like.

> Should I chain this with another action, so i'd have <forward name="template1"
> path="/editTemplate1.do" /> , where editTemplate1 action has the correct
> ActionForm?

Chaining like this is frowned upon and often can be avoided.

"Input" property does not define an input page, it defines an error
page. Struts architecture does not care where input is submitted from,
all it cares is what's in the request.

You should display /pages/selectTemplate.jsp with another action, so
selectTemplate.jsp would be output page for that action, and
editTemplateX.jsp would be output pages for EditAction. Again, there
are NO input pages in Struts.

See this for discussion: http://wiki.apache.org/struts/StrutsManualActionClasses

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org