struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From René Eigenheer <reigenh...@bridgesolutions.net>
Subject RE: how to Internationalized submit button?
Date Fri, 19 Jul 2002 08:28:04 GMT
i use different properties for each button:

example:
 <html:submit property="btnStore"><bean:message
key="btn.store"/></html:submit>
 <html:submit property="btnCancel"><bean:message
key="btn.cancel"/></html:submit>

if (btnStore != null) {
}
if (btnCancel != null) {
}



> -----Original Message-----
> From: Hoang, Hai [mailto:Hai.Hoang@coair.com]
> Sent: Freitag, 19. Juli 2002 05:56
> To: 'struts-user@jakarta.apache.org'
> Subject: how to Internationalized submit button?
>
>
> 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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message