You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Lemle <er...@ihc.com> on 2005/02/16 20:33:49 UTC

Re: String from the Resource Bundle into HTML:SUBMIT value atttibute???

<html:submit property="save"><bean:message key="global.button.save"
/></html:submit>

Eric D. Lemle
Senior Programmer / Analyst
Intermountain Health Care
36 South State Street, Suite 1100
Salt Lake City, Utah 84111 
United States of America (USA)
(801) 442-3688 -- e-mail: Eric.Lemle@IHC.com


>>> kosprov@hnet.teipir.gr 2/16/2005 11:23:51 AM >>>
Hi,

I'm new to the servlets/jsp/struts world so I have a question which
might seem trivial for most of you.

I want to set the value attribute of the <HTML:SUBMIT/> and
<HTML:RESET/> tags by taking the string from the resource bundle.

I'm developing an English/Greek web site with 2 .properties files so in
sake of elegancy and uniformity (?) I want to continue getting ALL the
content from these 2 files.

Although I found altKey and titleKey attributes, I don't seem to find
any valueKey which would do the work.

I forged some code that works but it seems a bit jackleg-ish (?)

Here is a simplyfied fragment of it (omitted all null checkings):

...
<%@ page import="org.apache.struts.util.PropertyMessageResources" %>
...
<html:form action="/search.do">
<table>
...
<% 
   PropertyMessageResources pmr = (PropertyMessageResources) 
application.getAttribute("org.apache.struts.action.MESSAGE");
   String resetTag = pmr.getMessage(request.getLocale()
,"button.search.resettag");
   String submitTag = pmr.getMessage(request.getLocale()
,"button.search.submittag");
%>
<tr>
<td><html:reset value="<%= resetTag %>"/></td>
<td><html:submit value="<%= submitTag %>"/></td>
</tr>
</table>
</html:form>
...

I guess I can tidy up a bit and have something like:

<html:reset value="<%= ButtonTags.getMessage("button.search.resettag")
%>"/>

or maybe (not tested yet):

<bean:define id="resetButtomTag">
       <bean:message key="button.search.resettag"/>
</bean:define>
<html:reset value="<%= resetButtomTag %>" />

but before I do that I would like to ask if there's something already
available.

Thnx,
Kostas

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


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