Search code examples
struts2setognl

Struts2 Setting a List Variable


I have a list at Struts2 and I want to define a variable for it. I did that:

<s:set name="userList" value="retrieveUserList(@com.company.project.commons.beans.Profile@YOURSELF.typeId)"/> 

I want to get the elements of it, for example:

<s:property value="retrieveUserList(@com.company.project.commons.beans.Profile@YOURSELF.typeId)[5].name"/> 

was working but after I set, it I want to use that variable bu this doesn't work:

<s:property value="#userList[5].name"/>

How to use it?


Solution

  • It should be like that:

    <s:property value="%{#userList[5].name}"/>