views:

10

answers:

1

Hello.

I want to show a property of an object in my Jsp page. the problem is that this property is the name of a label in my resource bundle and the only way I know is to use <s:text name="labelname"> but now that it's a property of an object, I don't know how to do this. This is a part of my code, 'brandList' is a list of brand objects and 'brandName' field is name of label. I want something like this

       <s:iterator value="brandList" status="stat">
            <s:text name="<s:property value='brandName'>" />
       </s:iterator>

but this doesn't work. any idea? Thanks in advance.

+1  A: 

Try this:

<s:iterator value="brandList" status="stat" var="brandName">
    <s:text name="%{brandName}" />
</s:iterator>
Lauri Lehtinen
thanks for reply but It says attribute var is not defined for iterator tag.
Zim
Thank you so much, I changed var to id and it worked.
Zim
Alright, `id` has been deprecated and `var` is to be used in newer versions of Struts 2 (http://struts.apache.org/2.0.14/docs/iterator.html)
Lauri Lehtinen