Reputation: 243
In the .jsp file I iterate the userList and the header list . The id attribute of the tag holds an instance of the data present in the list. this id is used in the java scriptlets to implement the application logic.
<logic:iterate id="a" name="ExcelForm" property="userList">
<tr>
<logic:iterate id="b" name="ExcelForm" property="header">
<td>
String a = (data.get(header) instanceof String)? ((String) data.get(header)) : (((String[])data.get(header)).length > 1000 ? ((String[])data.get(header))[1000] : "");
....
%>
</td>
</tr>
</logic:iterate>
Is necessary to convert this to Struts2 but I don't know how can I use the OGNL variable in the scriptlets.
<s:iterator var="a" value="%{userList}">
<tr>
<s:iterator var="b" value="%{header}">
<td>
String a = (data.get(header) instanceof String)? ((String) data.get(header)) : (((String[])data.get(header)).length > 1000 ? ((String[])data.get(header))[1000] : "");
....
%>
</td>
</s:iterator>
</tr>
</s:iterator>
Upvotes: 1
Views: 426
Reputation: 1
You can use s:set
tag that creates a variable in a specified scope (action scope by default) and assign it a value as a result of OGNL expression evaluation.
<s:set var="a" value='%{(data.get(header) instanceof String)? ((String) data.get(header)) : (((String[])data.get(header)).length > 1000 ? ((String[])data.get(header))[1000] : "")}'/>
Upvotes: 1