the above code does not work and gives an error:
javax.servlet.ServletException:
According to TLD or attribute directive in tag file,
attribute name does not accept any expressions
when I change the tag to - <s:i18n name="sla_ja_JP">
then everything is fine and I see japanese chars in the UI
my question is - how do I make this dynamic, in my app
the locale is retrieved from a database and the property
value (in this case sla_ja_JP) needs to be set accordingly,
so I cannot just hard-code <s:i18n name="sla_ja_JP">,
the value "sla_ja_JP" needs to be passed in dynamically,
can someone suggest a solution, thanks in advance.
Expose the name attribute as an action property (or anything else on the value stack). Scriptlets have no business in JSPs anymore.
Prasad Ven
Greenhorn
Joined: Feb 23, 2010
Posts: 3
posted
0
Hi David, thanks for your reply, can you give me a quick example
on how to do that (or point me to a tutorial), I tried doing something
like this but did not work - <s:i18n name="%{#page.test}">
David Newton wrote:Expose the name attribute as an action property (or anything else on the value stack). Scriptlets have no business in JSPs anymore.
in the above code, when I set i18n name="sla_ja_JP" then it works,
but when I do i18n name="%{#page.slaBundle}" then I just get back
"sla.text.test_prov" in the UI (I dont get the japanese chars), do I have
the right syntax there?
I verified that the variable is actually in the page context by doing
a pageContext.getAttribute("slaBundle") and it displays the value
properly.
also, how do I retrieve the value of slaBundle within a struts
textfield, I tried the following tags but it did not work:
<s:textfield label="text1" name="text1" value="%{#page.slaBundle}"/>
<s:textfield label="text2" name="text2" value="#page.slaBundle"/>