开发者

passing values from tiles2 definition to jsp file in struts2

开发者 https://www.devze.com 2023-03-22 23:11 出处:网络
I am using tiles 2 with struts2. My tiles definition look like this:- <definition name=\"store-tiles\" extends=\"baseLayout\">

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.


I think this could do it:

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

精彩评论

暂无评论...
验证码 换一张
取 消