Hi all,
I'm pretty new to struts, and just started developing a fairly
simple app, however taking a bit beyond the standard example functionality.
I have a (probably) pretty simple question:
I'm in the perform method of the Action class, processing a form submit, but
want to
forward to different mappings depending on which button was pressed.
In the JSP I am using the ApplicationResources.properties file to create the
button text for the
different buttons, so now I need to access this text also to determine which
action to
take.
So how do I access the descriptions from the properties file in the Action
class?
my form:
-------------------
<tr>
<td colspan="5" align="right">
<html:submit styleClass="bodyform">
<bean:message key="button.cancel"/>
</html:submit> </td>
<td>
<html:submit styleClass="bodyform">
<bean:message key="button.edit"/>
</html:submit> </td>
<td>
<html:submit styleClass="bodyform">
<bean:message key="button.confirm"/>
</html:submit></td>
</tr>
-------------------
So what do I put at the ... in the following fragment of the perform()
method to
be able to get the textual value of the button.cancel and button.edit?
-------------------
String submit = request.getParameter("submit");
// Forward control depending on which button was pressed
if (submit.equals(...))
return (mapping.findForward("cancel"))
else if (submit.equals(...))
return (mapping.findForward("edit"))
-------------------
Thanks,
Martijn.