aspose file tools*
The moose likes Struts and the fly likes Dynamic Submit Buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic Submit Buttons" Watch "Dynamic Submit Buttons" New topic
Author

Dynamic Submit Buttons

Naveen Chunduru
Greenhorn

Joined: Dec 13, 2005
Posts: 6
I am displaying a dynamic set of labels and corresponding submit buttons on my JSP.

The corresponding code is as follows:

<c:forEach items="${CDActionForm.caseCollection}" var="cStatusActionForm">

${cStatusActionForm.caseNumber}

<html:submit property="submitButtonAction" styleId="submitButtonAction" styleClass="formButton">
<bean:message key="<%=Constants.VIEW_BUTTON_KEY%>" />
</html:submit>

</c:forEach>

All the submit buttons take me to a same action method in the Action class.
In the action method I want to know the label value corresponding to the button which generated the event. How do I do that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

"Naveen Ch", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just add a "submitButtonAction" property to your ActionForm. When the form is submitted, this property will contain the label text of the button that was pressed. Bear in mind that if you're using i18n, the text will vary according to the current locale of the user.


Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: Dynamic Submit Buttons