You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ahmed Hashim <en...@gmail.com> on 2006/03/15 10:27:48 UTC

Re: Multiple buttons with Dispatch Action

I'd like to ask about the LookupDispatchAction
If my action extends from LookupDispatchAction, can I use the execute method
In case the user request the Action Directly? not from clicking a button?

I want the action to do the following:
1- Load the page
2- When the user click on button X it will execute function X
3- When the user click on the button Y it will execute function Y
4- When the user click on the button Z it will execute function Z

I have another problem, the button Y,Z have the same value "add" how can I
distinguish between them?

Thanks for your help.

On 2/17/06, Michael Jouravlev <jm...@gmail.com> wrote:
>
> Use this one: http://issues.apache.org/bugzilla/attachment.cgi?id=17485
> The related ticket:
> http://issues.apache.org/bugzilla/show_bug.cgi?id=38343
>
> This class is better, simpler and leaner than LookupDispatchAction.
>
> Michael.
>
> On 2/16/06, Sun Shine <sp...@yahoo.com> wrote:
> > Hi,
> > I have a page with multiple 'links'. One is an image
> > button and another is a simple submit button.
> >
> > I was using a Dispatch action that maps to each one of
> > these buttons, using javascript to set the
> > methodToCall on each of the buttons. worked like a
> > charm until...
> >
> > I was informed I cannot use javascript for page
> > direction(in case users browser is javascript
> > disabled.).
> >
> > So, the only way I could think of is to wrap the img
> > and submit button around an href and link to my
> > dispatch action (e.g. < a href="/MyDispatch.do"/>.
> >
> > Now, it seems it's skipping my validation done in the
> > action form.
> >
> > Can anyone tell me what I'm doing wrong OR is there a
> > better way(I'm sure there is...). how about
> > LookupDispatchAction?
> >
> > Any help is greatly appreciated!!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
http://del.icio.us/ahashim

Re: Multiple buttons with Dispatch Action

Posted by Ahmed Hashim <en...@gmail.com>.
I think it will be better to change one of the buttons.

Anyway, Thank too much for your help.


On 3/15/06, Dave Newton <ne...@pingsite.com> wrote:
>
> Niall Pemberton wrote:
> > LOL, maybe we can work together on a LazyRandomDispatchAction
> > implementation?
> >
>
> Ah, that would be better; it would save having to write the methods
> until they're called.
>
> "Gah; I'm getting a page from the website. I have to write an action
> method--hang on."
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
http://del.icio.us/ahashim

Re: Multiple buttons with Dispatch Action

Posted by Dave Newton <ne...@pingsite.com>.
Niall Pemberton wrote:
> LOL, maybe we can work together on a LazyRandomDispatchAction
> implementation?
>   

Ah, that would be better; it would save having to write the methods
until they're called.

"Gah; I'm getting a page from the website. I have to write an action
method--hang on."

Dave



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


Re: Multiple buttons with Dispatch Action

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
LOL, maybe we can work together on a LazyRandomDispatchAction
implementation?

Niall
----- Original Message ----- 
From: "Dave Newton" <ne...@pingsite.com>
Sent: Wednesday, March 15, 2006 4:00 PM


>
> Use my implementation of RandomDispatchAction, which will run a
> pseudo-random method matching a given method signature on each action
> execute.
>
> Deterministic behavior is for the weak; we are strong.
>
> Dave



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


Re: Multiple buttons with Dispatch Action

Posted by Dave Newton <ne...@pingsite.com>.
Wendy Smoak wrote:
> No.  LDA does a reverse lookup from the property value to the key (and
> then from the key to the method name.)  If there are two identical
> values in your .properties file, how would it know which key to pick?
>   

Use my implementation of RandomDispatchAction, which will run a
pseudo-random method matching a given method signature on each action
execute.

Deterministic behavior is for the weak; we are strong.

Dave



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


Re: Multiple buttons with Dispatch Action

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/15/06, Ahmed Hashim <en...@gmail.com> wrote:

> Can I solve the problem of 2 buttons with the same name using
> LookupDispatchAction ?

No.  LDA does a reverse lookup from the property value to the key (and
then from the key to the method name.)  If there are two identical
values in your .properties file, how would it know which key to pick?

--
Wendy

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


Re: Multiple buttons with Dispatch Action

Posted by Ahmed Hashim <en...@gmail.com>.
I'll solve the execute calling.

the problem is the class EventActionDispatcher comes with struts 1.2.9
I am using 1.2.8

Can I solve the problem of 2 buttons with the same name using
LookupDispatchAction ?



On 3/15/06, Michael Jouravlev <jm...@gmail.com> wrote:
>
> On 3/15/06, Ahmed Hashim <en...@gmail.com> wrote:
> > I'd like to ask about the LookupDispatchAction
> > If my action extends from LookupDispatchAction, can I use the execute
> method
> > In case the user request the Action Directly? not from clicking a
> button?
>
> execute() is always called first.
>
> > I want the action to do the following:
> > 1- Load the page
> > 2- When the user click on button X it will execute function X
> > 3- When the user click on the button Y it will execute function Y
> > 4- When the user click on the button Z it will execute function Z
> >
> > I have another problem, the button Y,Z have the same value "add" how can
> I
> > distinguish between them?
> >
> > Thanks for your help.
> >
> > On 2/17/06, Michael Jouravlev <jm...@gmail.com> wrote:
> > >
> > > Use this one:
> http://issues.apache.org/bugzilla/attachment.cgi?id=17485
> > > The related ticket:
> > > http://issues.apache.org/bugzilla/show_bug.cgi?id=38343
> > >
> > > This class is better, simpler and leaner than LookupDispatchAction.
> > >
> > > Michael.
> > >
> > > On 2/16/06, Sun Shine <sp...@yahoo.com> wrote:
> > > > Hi,
> > > > I have a page with multiple 'links'. One is an image
> > > > button and another is a simple submit button.
> > > >
> > > > I was using a Dispatch action that maps to each one of
> > > > these buttons, using javascript to set the
> > > > methodToCall on each of the buttons. worked like a
> > > > charm until...
> > > >
> > > > I was informed I cannot use javascript for page
> > > > direction(in case users browser is javascript
> > > > disabled.).
> > > >
> > > > So, the only way I could think of is to wrap the img
> > > > and submit button around an href and link to my
> > > > dispatch action (e.g. < a href="/MyDispatch.do"/>.
> > > >
> > > > Now, it seems it's skipping my validation done in the
> > > > action form.
> > > >
> > > > Can anyone tell me what I'm doing wrong OR is there a
> > > > better way(I'm sure there is...). how about
> > > > LookupDispatchAction?
>
> Do not use LookupDispatchAction, use EventDispatchAction or even
> better, EventActionDispatcher:
> http://wiki.apache.org/struts/EventActionDispatcher
>
> Michael.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
http://del.icio.us/ahashim

Re: Multiple buttons with Dispatch Action

Posted by Michael Jouravlev <jm...@gmail.com>.
On 3/15/06, Ahmed Hashim <en...@gmail.com> wrote:
> I'd like to ask about the LookupDispatchAction
> If my action extends from LookupDispatchAction, can I use the execute method
> In case the user request the Action Directly? not from clicking a button?

execute() is always called first.

> I want the action to do the following:
> 1- Load the page
> 2- When the user click on button X it will execute function X
> 3- When the user click on the button Y it will execute function Y
> 4- When the user click on the button Z it will execute function Z
>
> I have another problem, the button Y,Z have the same value "add" how can I
> distinguish between them?
>
> Thanks for your help.
>
> On 2/17/06, Michael Jouravlev <jm...@gmail.com> wrote:
> >
> > Use this one: http://issues.apache.org/bugzilla/attachment.cgi?id=17485
> > The related ticket:
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=38343
> >
> > This class is better, simpler and leaner than LookupDispatchAction.
> >
> > Michael.
> >
> > On 2/16/06, Sun Shine <sp...@yahoo.com> wrote:
> > > Hi,
> > > I have a page with multiple 'links'. One is an image
> > > button and another is a simple submit button.
> > >
> > > I was using a Dispatch action that maps to each one of
> > > these buttons, using javascript to set the
> > > methodToCall on each of the buttons. worked like a
> > > charm until...
> > >
> > > I was informed I cannot use javascript for page
> > > direction(in case users browser is javascript
> > > disabled.).
> > >
> > > So, the only way I could think of is to wrap the img
> > > and submit button around an href and link to my
> > > dispatch action (e.g. < a href="/MyDispatch.do"/>.
> > >
> > > Now, it seems it's skipping my validation done in the
> > > action form.
> > >
> > > Can anyone tell me what I'm doing wrong OR is there a
> > > better way(I'm sure there is...). how about
> > > LookupDispatchAction?

Do not use LookupDispatchAction, use EventDispatchAction or even
better, EventActionDispatcher:
http://wiki.apache.org/struts/EventActionDispatcher

Michael.

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