Reputation: 683
I am trying to display the list data using struts 2 tags. I have list has follows
List ==> Array of Object ==> Object of class
i can get the values from list using java code as follows
for(int i=0;i<redemptionDetails.size();i++)
{
Object[] Obj=(Object[])redemptionDetails.get(i);
PointsRedemption ptredim=(PointsRedemption)Obj[0];
System.out.println(ptredim.getCarrierId());
}
where redemptionDetails
is list.
but when I try to display using Struts2 tags I am not able to view details
I have tried below using Struts2 tags
<s:iterator value="redemptionDetails" status="redemptionDetails">
<s:set var="redemptionObject"
value="redemptionDetails.PointsRedemption"
scope="application"></s:set>
<s:set var="productObject"
value="redemptionDetails.PointsProduct"
scope="application"></s:set>
<script>
//alert(<s:property value="#redemptionObject" />);
</script>
<tr>
<td><s:property value="#application.redemptionObject.productCode" /></td>
<td><s:property value="#application.productObject.productCode" /></td>
</tr>
</s:iterator>
but I am not able to get the desire result. please help
Upvotes: 1
Views: 249
Reputation: 24396
To display values in JSP inside <s:iterator>
tag use top
keyword to get current iterator value.
<s:iterator value="redemptionDetails">
<s:property value="top[0].carrierId"/>
</s:iterator>
Upvotes: 2