If I'm reading it correctly there is a risk of infinite recursion in
there (if the parameter is the same as the current action).
bests,
./alex
--
.w( the_mindstorm )p.
On 8/28/07, jpedro <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have written this Action for a project. It uses the parameter of a mapped
> action and gets the parameter's value from the request to execute the action
> forward.
>
> Also it has a default forward that is used when the forward parameter is not
> present in the request.
>
> The action code is:
>
> public class DynamicForwardAction extends Action {
>
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest req,
> HttpServletResponse resp) throws Exception {
>
> ActionForward forward =
> mapping.findForward(req.getParameter(mapping.getParameter()));
> return (forward != null) ? forward :
> mapping.findForward("default");
> }
> }
>
> An example of the mapping of this Action is:
>
> <action path="/dosomething"
> type=" DynamicForwardAction"
> validate="false"
> parameter="option">
> <forward name="opt1" path="app.forward1" />
> <forward name="opt2" path="app.forward2" />
> <forward name="default" path="app.defaultfForward" />
> </action>
>
> If this action is invoked with something like "/dosomething.do?option=op1"
> the specified forward "op1" will be executed.
>
> If you think that this action may be useful for struts, fell free to include
> it.
>
> Best regards,
> JP
>
> --
> View this message in context:
> http://www.nabble.com/DynamicForwardAction-for-your-consideration-tf4341571.html#a12367415
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]