0

I want to make the titleKey attribute parametric by accessing a property into the Struts 2 Value Stack. So, I'd like to do something like this:

<display:table name="myListOfObjects" id="myId" requestURI="/myAction.action" pagesize="10">
    <display:column property="myProperty" titleKey="my.internationalyzed.i18n.key.myProperty.<s:property value='anotherObject.aProperty'/>" />
    ...

As you see, I'd want to access a property into an exposed object in my action with

<s:property value='anotherObject.aProperty'/>

and to put the value into the titleKey element.

If I do this, the result is a table column with an unresolved my.internationalyzed.i18n.key.myProperty string as title. In other words, the <s:property> tag is not interpreted inside the <display:column> element.

But if I put the

<s:property value='anotherObject.aProperty'/>

outside the <display:table> element it is correctly resolved and the resulting value is showed on the page, so the property is correctly exposed and valorized.

Do you know how can I access a property exposed in an action from inside the <display:column> element?

Roman C
  • 49,761
  • 33
  • 66
  • 176

1 Answers1

0

You can use JSP EL expression inside your non-struts tag, so the expression when looking in the request scope will ask the request to expose the value stack. For example

<display:column property="myProperty" titleKey="my.internationalyzed.i18n.key.myProperty.${anotherObject.aProperty}" />
Roman C
  • 49,761
  • 33
  • 66
  • 176