You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Пламен Узунов <pu...@gmail.com> on 2009/02/16 10:15:16 UTC

Howto move a property from a scope to the Value Stack?

Hello,

I have following in tiles-defs.xml:
...
<definition name="tiles.tabs.foouser" extends="tiles.tabs">
    <put-list-attribute name="tabs">
        <item value="TAB_ACTION1" link="action1.action" />
        <item value="TAB_ACTION2" link="action2.action" />
        <item value="TAB_ACTION3" link="action3.action" />
        <item value="TAB_ACTION4" link="action4.action" />
        <item value="TAB_ACTION5" link="action5.action" />
    </put-list-attribute>
</definition>
...

Where values in 'item' element are keys in my tiles.properties file. This I
use to internationalize the tabs and menus in my Struts 2 application.
I can't obtain from the lang. prop. file the values for the corresponding
locale in jsp. I think the code doing this should be something like the
following:
...
<tiles:importAttribute name="tabs"/>
<c:forEach var="item" items="${tabs}">
    <td class="maintab_back" valign="top">
         <s:i18n name="com.so.was.tiles.resources.tiles" >
        <s:text name="${item.value}" />
         </s:i18n>
    </td>
</c:forEach>
...

When I use the above code in my jsp I got following exception:
According to TLD or attribute directive in tag file, attribute name does not
accept any expressions
        at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
        at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
        at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
        at
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:952)
...

I want to take the value of the item, depending on the currently chosen
language from a language property file and to put it in the jsp in order it
to be rendered into html and displayed in the web page in that language.


-- 
Plamen Uzunoff,
puzunoff@gmail.com.