jeet
jeet

Reputation: 95

passing values from tiles2 definition to jsp file in struts2

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.

Upvotes: 3

Views: 2756

Answers (1)

doctrey
doctrey

Reputation: 1227

I think this could do it:

<tiles:importAttribute name="title"/>
<tiles:importAttribute name="menuLink"/>
<s:property value="#attr['title']"/>
<s:property value="#attr['menuLink']"/>

Upvotes: 5

Related Questions