I put keys into the tile definition eg
<definition name="default-layout" path="/pages/default-layout.jsp">
<put name="windowTitle" value="main.window.title"/>
Then I just treat them as keys. Using either JSTL/EL (<fmt:message>)or
Struts tags (<bean:message>) to fetch the text from the message resources.
The tiles tags don't provide a method of getting the value directly from
the resource.
so I use <tiles:importAttribute scope="request"/> so that the values are
available in any of my tiles, then using JSTL/EL I can use ${windowTitle}
in any tag as the key.
eg
<fmt:message key="${windowTitle}"><fmt:param
value="${someOtherParam}"/> </fmt:message>
or
<bean:message key="${windowTitle}" arg0="${someOtherParam}"/>
Mark Womack wrote:
I can't imagine that this question has not been asked before, but I could
not dig up answers in the mail archives or the online documentation. I
apologize in advance if there is an obvious answer that I do not see.
Instead of embedding a text value in my tiles definition file like this:
<definition name="default-layout" path="/pages/default-layout.jsp">
<put name="window-title" value="The title of the window here"/>
...
</definition>
I want it to reference the text from the message resources I have already
defined in my MessageResources.properties file:
main.window.title=The title of the window here
Maybe with something like this:
<definition name="default-layout" path="/pages/default-layout.jsp">
<put name="window-title" value="main.window.title"/>
...
</definition>
Is there a way to do this? I'd rather have all of my localizable text in
one place, namely the message properties file. There should be a way to
reference strings from the message properties files by key...right?
I was expecting to find an attribute on the tiles:getAsString jsp tag.
Something like:
<tiles:getAsString name="window-title" useAsMessageKey="true"/>
or
<tiles:getAsString messageKey="window-title"/>
Like I said, I have to believe that this has come up as a question before.
I hope there is a good answer.
Thanks,
-Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Jason Lea
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]