As an alternative you can do the following;
 
In your ActionForm class put the following code;
 
    private int button = 0;

    public int getButton() {
     return (button);
    }
 
    public void setButton(int index, String name) {
     button = index;
    }

In the jsp page name your submit buttons as follows;
 
<html:submit property="button[0]"><bean:message
key="submit.something"/></html:submit> 
<html:submit property="button[1]"><bean:message
key="submit.something.else"/></html:submit>
...etc
 
In your action calling getButton() returns 0 if the first button was
pressed, 1 if the second was pressed and so on.
 
 
-----Original Message-----
From: Jon Wilmoth [mailto:[EMAIL PROTECTED]]
Sent: 23 March 2001 17:38
To: [EMAIL PROTECTED]
Subject: Multiple Submits per Form



After sifting through the archives, I only found one previous question about
handling multiple submit buttons in the same form.  The solution that was
proposed, was to read the label of the submit button present on the http
request params to figure out which button was actually submitted.  However,
this will not work (gracefully*) with internationalization.  If the client
facing label, the "value" attribute of the submit jsp tag, is used to
determine the code would need to check for "Login", "Inloggen" (Dutch),
"sich anmelden" (German), etc.  If I may suggest a hidden field that is
submitted (value set at button click by javascript) that is generated by the
form tag, with a constant for the name.  This decouples the presentation
from the application flow.  Thoughts?
 
*The most "graceful" solution I could think of would be to do a reverse
lookup in the message catalog for the local specific value.
 
 
************************************************
Jon Wilmoth
Software Architect
eSage Group
(206) 264-5675  (Voice & Fax)
[EMAIL PROTECTED]
 <http://www.esagegroup.com> http://www.esagegroup.com


Reply via email to