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:[EMAIL PROTECTED] Behalf Of sjones
Sent: Friday, May 30, 2003 4:14 PM
To: [EMAIL PROTECTED]
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: [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