peakit
peakit

Reputation: 29389

Struts2 - Nesting <s:property> in a custom tag

I have a custom struts2 tag:

<s:myTag myprop="..." >
...
</s:mytag>

And, I want to get the value of myprop attribute of myTag from the ValueStack. Like,

<s:myTag myprop='<s:property value="name"/>'>

So, I tried setting the rtexprvalue attribute for myprop to true but, still I am not able to see the <s:property/> nested inside the custom tag getting evaluated.

There is no error/exception, its just that the nested <s:property/> is not getting evaluated.

Can someone help me know how to get this working?

Thanks.

Upvotes: 2

Views: 1935

Answers (1)

lschin
lschin

Reputation: 6811

Try

<s:myTag>
    <s:param name="myprop">
        ${name}
    </s:param>
</s:mytag>

OR

<s:myTag>
    <s:param name="myprop" value="name" />
</s:mytag>

OR (Static Content)

<s:myTag>
    <s:param name="myprop">
        <s:property value="@some.package.ClassName@FOO_PROPERTY" />
    </s:param>
</s:mytag>

Upvotes: 3

Related Questions