You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "K. Provatas" <ko...@hnet.teipir.gr> on 2005/02/16 19:23:51 UTC
String from the Resource Bundle into HTML:SUBMIT value atttibute???
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