This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes message resources with buttons? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "message resources with buttons?" Watch "message resources with buttons?" New topic

message resources with buttons?

Bloo Barton
Ranch Hand

Joined: May 09, 2005
Posts: 63
Is there a way that I can add test from my MessageResources to a button using the Struts <html:button /> tag? I would like to be able to have my buttons' text support internationalization the same as the rest of the application.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I don't believe the html:button tag accomodates this. However, my opinion is that the html:button doesn't really offer much in the way of added function.

I would just use a regular <input> tag like this:

<input name="button1" type="button" value="'<bean:message key="msg.button1" />' >

Consultant, Sima Solutions
Gigi Kent
Ranch Hand

Joined: Nov 30, 2004
Posts: 40
It is very simple
<html:button property="idmodule"><bean:message key="key_from_messages_resources"/></html:button>

This way you will have internationalized your button.
Bloo Barton
Ranch Hand

Joined: May 09, 2005
Posts: 63
Cornel Cc,

Thanks, that is exactly what I needed to know. I did not realize you could put the label for the button in between the opening and closing tag. It is not that way with the standard HTML <input> tag.
I agree. Here's the link:
subject: message resources with buttons?
jQuery in Action, 3rd edition