You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mississippi John Hurt <jo...@gmail.com> on 2006/08/10 05:29:03 UTC

EventActionDispatcher, specifying event from ActionClass not JSP?

I'm using EventActionDispatcher and it works fine dispatching to events from
jsp.
But I have an ActionClass that I want to forward to another ActionClass so
how can I do a Struts forward so that I can specify which event on the 2nd
ActionClass to invoke?  I can only do a /2ndActionClass.do which will call
the 2nd ActionClass but how will it know which event method I want to
invoke? Thanks!

Re: EventActionDispatcher, specifying event from ActionClass not JSP?

Posted by kalpesh modi <mo...@yahoo.com>.
I havent used EventActionDispatcher. I have used EventDispatchAction, and I just do a forward as ...

return new ActionForward("/secondAction.do?anyEventName");

I just pass the methodName as the key. I do not use key=value. 

Also I use the button & link parameters as addCustomer, deleteCustomer etc.

Thanks,
-Kalpesh
 
Mississippi John Hurt <jo...@gmail.com> wrote: I tried this and it works...

return new ActionForward("/secondAction.do?anyEventName=OneOfParams");

the anyEventName can be anything, while OneOfParams has to be one of the
values in the parameter list in the struts config.
One possible problem is that it seems the dispatcher will simply try to
match each param from first to last with any form parameter so you have to
be careful that no form param values might resemble on of the parameters in
your struts config.

For example what is someone had an input field where they typed in 'delete'
and you had 1 of the parameters ie methods as 'delete', then the dispatcher
could very well match the delete methodparam with the delete value of the
form input field and trigger the delete() method.

Isn't this an issue anybody?

On 8/10/06, Mississippi John Hurt  wrote:
>
> It doesn't seem to pick up the eventName. It forwards to the 2nd action
> class alright, but somehow the EventActionDispatcher is told which event, is
> it via a form parameter or request attribute?  Which one?
>
>
> On 8/10/06, kalpesh modi  wrote:
> >
> > You can do something like
> >
> > return new ActionForward("/secondAction.do?eventName");
> >
> > Thanks,
> > -Kalpesh
> >
> > ---------------------------------
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> > countries) for 2¢/min or less.
> >
>
>


 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: EventActionDispatcher, specifying event from ActionClass not JSP?

Posted by Mississippi John Hurt <jo...@gmail.com>.
I tried this and it works...

return new ActionForward("/secondAction.do?anyEventName=OneOfParams");

the anyEventName can be anything, while OneOfParams has to be one of the
values in the parameter list in the struts config.
One possible problem is that it seems the dispatcher will simply try to
match each param from first to last with any form parameter so you have to
be careful that no form param values might resemble on of the parameters in
your struts config.

For example what is someone had an input field where they typed in 'delete'
and you had 1 of the parameters ie methods as 'delete', then the dispatcher
could very well match the delete methodparam with the delete value of the
form input field and trigger the delete() method.

Isn't this an issue anybody?

On 8/10/06, Mississippi John Hurt <jo...@gmail.com> wrote:
>
> It doesn't seem to pick up the eventName. It forwards to the 2nd action
> class alright, but somehow the EventActionDispatcher is told which event, is
> it via a form parameter or request attribute?  Which one?
>
>
> On 8/10/06, kalpesh modi <mo...@yahoo.com> wrote:
> >
> > You can do something like
> >
> > return new ActionForward("/secondAction.do?eventName");
> >
> > Thanks,
> > -Kalpesh
> >
> > ---------------------------------
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> > countries) for 2¢/min or less.
> >
>
>

Re: EventActionDispatcher, specifying event from ActionClass not JSP?

Posted by Mississippi John Hurt <jo...@gmail.com>.
It doesn't seem to pick up the eventName. It forwards to the 2nd action
class alright, but somehow the EventActionDispatcher is told which event, is
it via a form parameter or request attribute?  Which one?

On 8/10/06, kalpesh modi <mo...@yahoo.com> wrote:
>
> You can do something like
>
> return new ActionForward("/secondAction.do?eventName");
>
> Thanks,
> -Kalpesh
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> countries) for 2¢/min or less.
>

Re: EventActionDispatcher, specifying event from ActionClass not JSP?

Posted by kalpesh modi <mo...@yahoo.com>.
You can do something like

return new ActionForward("/secondAction.do?eventName");

Thanks,
-Kalpesh
 		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.