From: Stephane Grenier [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2003 5:40 PM
Subject: multiple submit redirect in action

> I would like to create a form with 2 submit buttons in the jsp:

> I would like to determine in the action which submit button 
> was pressed and forward from there based on some conditions. 
> How can I determine in the action which submit button was pressed ?

If you look at the documentation for the <html:submit....> tag, you'll see
that you can specify a "property" attribute.  That attribute contains the
name of a property of the form bean that will be set to the "value" of the
tag when the form is submitted. And the "value" of a "submit" button always
appears on the button.

So, if you have a form bean that contains two properties named "updated" and
"checkedOut", and you code these tags:

     <html:submit property="updated" value="Update" />
     <html:submit property="checkedOut" value="Checkout" />

Then if the "update" button is clicked, the updated property of the form
bean will contain the string "Update", and the "checkedOut" property will
contain an empty string. If the "Checkout" button is clicked, "checkedOut"
will contain "Checkout", and "updated" will be empty.

--
Tim Slattery
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to