Actually, I think the least amount of work (assuming you don't object to
adding a small amount of trivial JavaScript logic to the JSP page) is to
change your <html:submit> to an <html:button> and then add an onclick
JavaScript event handler that sets a hidden form field with the desired
submit action value before submitting the form. You can even embed the event
handler logic directly in the HTML button definitions like so:

<html:hidden property="action" value="" />

<html:button property="dontCare1"
  onclick="this.form.action.value='reset1';this.form.submit();" >
  <bean:message key="search.button.reset" />
</html:button>

<html:button property="dontCare2"
  onclick="this.form.action.value='reset2';this.form.submit();" >
  <bean:message key="search.button.reset" />
</html:button>

This should work even with two separate forms being used in the same JSP for
the two identically named buttons. Of course, you would then need two
instances of the <html:hidden> tag to include the "action" property in the
two separate HTML forms.

Note: I haven't tested this exact code snippet above. So, there could be
some minor typo in it. However, I have used this technique successfully in
the past.

Cheers, Van

Mike Van Riper
mailto:[EMAIL PROTECTED]
http://www.baychi.org/bof/struts

> -----Original Message-----
> From: Alex Shneyderman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 07, 2003 6:12 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Button labels and DispatchActions mix?
> 
> 
> I guees if you want to assign the meaning to your form based on the
> context where you placed it, it might make some sence. 
> 
> Todor, you can probably create another action and extend it from your
> original action, where you would override getKeyMethodMap (). 
> This will
> probably the least amount of work.
> 
> HTH,
> Alex.
> 
> > -----Original Message-----
> > From: Paul McCulloch [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 07, 2003 9:06 AM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Button labels and DispatchActions mix?
> > 
> > I'm not sure I understand you. Why would you want multple buttons,
> with
> > the
> > same label doing different things? Surely this would just 
> confuse the
> > user?
> > 
> > -----Original Message-----
> > From: Todor Sergueev Petkov [mailto:[EMAIL PROTECTED]
> > Sent: 07 August 2003 13:58
> > To: Struts Users Mailing List
> > Subject: Re: Button labels and DispatchActions mix?
> > 
> > 
> > 
> > Even DispatchLookupAction doesn't work if you want to use the same
> label
> > eg. buttons.reset or buttons.search
> > for two different buttons useing the same Action...
> > 
> > Paul McCulloch wrote:
> > >
> > > I believe that the solution is to use a 
> DispatchLookupAction rather
> than
> > a
> > > dispatch action. See p226 in Struts in Action for a description.
> > >
> > > Paul
> > >
> > > -----Original Message-----
> > > From: Rohit Aeron [mailto:[EMAIL PROTECTED]
> > > Sent: 07 August 2003 13:27
> > > To: Struts Users Mailing List
> > > Subject: RE: Button labels and DispatchActions mix?
> > >
> > > Its better you use javascript
> > > There you can append your action also with submit value
> > >
> > > Eg:
> > >
> > > Document.<formbean>.action="search.do"+"<value>";
> > >
> > > Regards
> > > Rohit
> > >
> > > -----Original Message-----
> > > From: Todor Sergueev Petkov [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, August 07, 2003 5:49 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Button labels and DispatchActions mix?
> > >
> > > It works with the button label.... But I have two Search 
> buttons on
> the
> > > same page both labeled
> > > search.button.reset but they perform two different actions. So I
> need a
> > > way to distinguish which was pressed
> > > inside my DispatchAction
> > >
> > > Rohit Aeron wrote:
> > > >
> > > > This will work ..
> > > >
> > > > <html:submit property="action"
> > > > value="<bean:message key="search.button.reset" />" >
> > > > </html:submit>
> > > >
> > > > -----Original Message-----
> > > > From: Todor Sergueev Petkov [mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday, August 07, 2003 5:29 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Button labels and DispatchActions mix?
> > > >
> > > > Hello people,
> > > >
> > > > I have the following code :
> > > >
> > > >  <html:submit property="action" value="resetg" >
> > > >      <bean:message key="search.button.reset" />
> > > >  </html:submit>
> > > >
> > > > What I am trying to do is have a Dispatch Action
> > > > so that when this button is pressed the request is 
> something like
> > > > search.do?action=resetg
> > > > But I don't want my button to have the resetg title on 
> it. I want
> it
> > to
> > > > have the search.button.reset title from ApplicationResources
> bundle
> > > > on it. It seems tha Struts html tag library mixes the two. Is
> there a
> > > > way out of this?
> > > >
> > > > Thanks....
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > >
> > > > *----------
> > > > This message and any attachment(s) is intended only for 
> the use of
> the
> > > addressee(s) and may contain information that is PRIVILEGED and
> > > CONFIDENTIAL. If you are not the intended addressee(s), you are
> hereby
> > > notified that any use, distribution, disclosure or copying of this
> > > communication is strictly prohibited. If you have received this
> > > communication in error, please erase all copies of the message and
> its
> > > attachment(s) and notify the sender or Kanbay postmaster
> immediately.
> > > >
> > > > Any views expressed in this message are those of the individual
> sender
> > and
> > > not of Kanbay.
> > > >
> > > > Although we have taken steps to ensure that this e-mail and any
> > > attachment(s) are free from any virus, we advise that in keeping
> with
> > good
> > > computing practice the recipient should ensure they are actually
> virus
> > free.
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > 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]
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > >
> > > **************************************
> > > Axios Email Confidentiality Footer
> > > Privileged/Confidential Information may be contained in this
> message. If
> > you are not the addressee indicated in this message (or responsible
> for
> > delivery of the message to such person), you may not copy or deliver
> this
> > message to anyone. In such case, you should destroy this 
> message, and
> > notify
> > us immediately. If you or your employer does not consent to Internet
> email
> > messages of this kind, please advise us immediately. Opinions,
> conclusions
> > and other information expressed in this message are not given or
> endorsed
> > by
> > my Company or employer unless otherwise indicated by an authorised
> > representative independent of this message.
> > > WARNING:
> > > While Axios Systems Ltd takes steps to prevent computer 
> viruses from
> > being
> > transmitted via electronic mail attachments we cannot guarantee that
> > attachments do not contain computer virus code.  You are therefore
> > strongly
> > advised to undertake anti virus checks prior to accessing the
> attachment
> > to
> > this electronic mail.  Axios Systems Ltd grants no warranties
> regarding
> > performance use or quality of any attachment and undertakes no
> liability
> > for
> > loss or damage howsoever caused.
> > >
> > >
> ---------------------------------------------------------------------
> > > 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]
> > 
> > 
> ---------------------------------------------------------------------
> > 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]

Reply via email to