struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <>
Subject Re: Submit Actions
Date Wed, 03 Jul 2002 13:54:57 GMT
At 9:00 AM -0400 2002/07/03, Kamholz, Keith   (corp-staff) USX wrote:
>Hey everyone,
>I have a question that may have a very simple answer.  I have a small form
>where the user enters an entry number.  There are two submit buttons, one
>for a 'Delete' and the other to 'Edit'.  I want to send a different
>parameter to the action depending on which button is clicked.  It would
>indicate whether a 'Delete' or an 'Edit' was requested.  However, right now
>my form tag just says <html:form action="/">.  How can
>I change this so that I can send the correct parameter that corresponds to
>the button pressed?  I'm sure someone knows how to this.

If your submit buttons are regular HTML buttons (as opposed to 
images) then the "value" of the button is sent as a request parameter 
matching the name/property of the button.

something like this:
<html:form action="/">
<html:submit property="action" value="delete" />
<html:submit property="action" value="edit" />

There was some recent discussion on the list about what to do if the 
value of your button is localized, which makes it harder to test the 
value of the parameter... I can't remember what the conclusion was, 
but I imagine you could use the message resources in your action to 
get the localized version of the string to compare to the parameter.

If you're using images instead of submit buttons, you might want to 
check out Ted Husted's tip on ImageButtonBeans 

I think you can manage this without JavaScript though.


* Joe Germuska    { }
"It's pitiful, sometimes, if they've got it bad. Their eyes get 
glazed, they go white, their hands tremble.... As I watch them I 
often feel that a dope peddler is a gentleman compared with the man 
who sells records."
	--Sam Goody, 1956
tune in posse radio: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message