You can use hidden field and Javascript.
<SCRIPT>
function setAction(target) {
document.forms[0].actionName.value=target;
}
</SCRIPT>
$B!D(B
<html:hidden property="actionName" value="Add"/>
<html:submit
property="foo" onClick="setAction('Add');"/><bean:message
key="button.add"/></html:submit>
<html:submit
property="foo" onClick="setAction('Remove');"/><bean:message
key="button.remove"/></html:submit>
Hoang, Hai wrote:
>I want to internationalize the submit buttons on a form and I don't know how
>to do it. Currently, I mapped the value on the submit button to the
>property actionName in the ActionForm class. Base on the button the use
>clicked, I handle it propriately in the Action class, just like event
>handling mechanism. Now if I internationalize these buttons (<html:submit
>property="actionName"/><bean:message key="button.add"/></html:submit>, the
>value will change and my Action class will no longer work. Is there a way
>to work around this problem?
>
>To be specific, following is the detail about my setup
>
>1. jsp page:
>
><html:submit property="actionName" value="Add"/>
><html:submit property="actionName" value="Edit"/>
><html:submit property="actionName" value="Remove"/>
>
>2. actionForm class:
>
>public String getActionName()
>{
> return actionName;
>}
>
>public void setActionName( String actionName)
>{
> this.actionName = actionName;
>}
>
>
>3. action class:
>
>ApplicationForm applicationForm = (ApplicationForm)form;
>String action = applicationForm.getActionName();
>if (action == null)
>{
> action = Constants.BUTTON_CANCEL;
>}
>
>if (action.equals(Constants.BUTTON_CANCEL))
>{
> applicationForm.setActionName(null);
> doAdd(mapping, applicationForm, request, response);
>}
>else if (action.equals(Constants.BUTTON_ADD))
>{
> doAdd(mapping, applicationForm, request, response);
>}
>else if (action.equals(Constants.BUTTON_SAVE))
>{
> doSave(mapping, applicationForm, request, response);
>}
>else if (action.equals(Constants.BUTTON_EDIT) ||
> action.equals(Constants.BUTTON_REMOVE))
>{
> doEdit(mapping, applicationForm, request, response);
>}
>else if (action.equals(Constants.BUTTON_UPDATE))
>{
> doUpdate(mapping, applicationForm, request, response);
>}
>else if (action.equals(Constants.BUTTON_DELETE))
>{
> doDelete(mapping, applicationForm, request, response);
>}
>
>Thank you for your help
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
>