You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sjones <sj...@yahoo.com> on 2003/06/02 15:25:53 UTC

Re: - How do you detect which button was clicked.

Thanks i will try this.

"Brandon Goodin" <ma...@phase.ws> wrote in message
news:MCEFJGLDHNNMPENCIDECKEFBFKAA.mail@phase.ws...
> Read the docs on DispatchAction/LookupDispatchAction. But, basically, give
> your buttons both the same name. Then whichever one is clicked will be the
> value. Then you can determine what needs to be done server side.
>
> Brandon Goodin
>
> -----Original Message-----
> From: news [mailto:news@main.gmane.org]On Behalf Of sjones
> Sent: Friday, May 30, 2003 4:14 PM
> To: struts-user@jakarta.apache.org
> Subject: <html:button> - How do you detect which button was clicked.
>
>
> All,
>
>
> I have a Jsp with two button in one form. The button click
> determines what page the users sees next.
>
> How do i detect which button was clicked.
>
> i tryed to change the hidden field before submitting the form
> but that is not working.
>
> It is driving me nuts !!
>
>
> I have :
> <html:form action="/CreateTask.do" method="GET">
>  <html:hidden property="dispatch" value="error"/>
>  <h1><bean:message key="title"/></h1>
>  <html:button property="button1" value="success1" onclick="submit()"/>
>  <html:button property="button2" value="success2" onclick="submit()"/>
> </html:form>
>
> and in my Action.java :
>
>  DynaActionForm dynaForm = (DynaActionForm)form;
>  String strAction = (String)dynaForm.get("dispatch");
>  System.out.println("strAction= " + strAction);
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org




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