3

I am using tiles 2 with struts2. My tiles definition look like this:-

        <definition name="store-tiles" extends="baseLayout">    
           <put-attribute name="title" value="test"  />
           <put-attribute name="menulink" value="support" type="string" />
           <put-attribute name="slider" value="/empty.jsp" />
           <put-attribute name="products" value="/products.jsp" />
        </definition>

I want to use title or menulink variale in products.jsp as jsp variable

           <tiles:useAttribute name="menulink"/>
           <c:out value="${menulink}"/>

It throws exceptions that expression is not allowed in c:out. I have seen the same thing working fine with Struts 1.x and tiles 1.x version. whats the issue with Struts2/tiles2 ?

Please give me a workaround.

jeet
  • 95
  • 2
  • 9

1 Answers1

5

I think this could do it:

<tiles:importAttribute name="title"/>
<tiles:importAttribute name="menuLink"/>
<s:property value="#attr['title']"/>
<s:property value="#attr['menuLink']"/>
doctrey
  • 1,227
  • 1
  • 12
  • 25