Thank you Peter,
It has also now been pointed out to me that you can set the value of a
submit button by using a two part tag
<html:submit>
<bean:message key="submit.value">
</html:submit>
or something close to this if I remember correct. I have found it hard to
get some docs on this.
Cheers
Neil
-----Original Message-----
From: Peter Alfors [mailto:[EMAIL PROTECTED]]
Sent: 24 May 2001 14:39
To: [EMAIL PROTECTED]
Subject: Re: dynamic button names
It looks as though the ButtonTag and SubmitTag do not allow you to do this.
Therefore, you have a few other options.
1. Use HTML along with the message tag...
<INPUT type="submit" name="btnSubmit" id="btnSubmit" value="<html:message
key="myBundleKey"/>">
2. Write your own custom tag. You could extend the SubmitTag and over-ride
the getValue() call to retrieve a resoure bundle key.
3. Last resort: Retrieve the bundle key through the message resources class
and place it into a script variable.
Then place the script variable in the custom tag...
This is ugly, so I would not do this unless you have a good reason to.
MessageResources bundle =
(MessageResources)
pageContext.getServletContext().getAttribute(Action.MESSAGES_KEY);
String myValueRetrievedFromBundle = bundle.getMessage("myKey");
<html:submit property="btnSubmit" value="<%= myValueRetrievedFromBundle
%>"/>
(The code may not be exactly right.. I have not implemented this myself)
HTH,
Pete
Neil Blue wrote:
> Hello,
>
> I am planning a struts app and I would like to know please if there is a
> way to set the text of a submit button, based on a key from the
> ApplicationResources.properties file.
>
> Thank you
>
> Neil Blue