Struts2 cannot display output

I am trying to display list data using struts 2 tags. I have a list

List ==> Object array ==> Class object

I can get values ​​from a 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 redemptionDetailsis the list.

but when I try to display using the Struts2 tags, I cannot view the details

I tried 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 cannot get the result of desire. please, help

+1
source share
1 answer

To display values ​​in the JSP inside the tag, <s:iterator>use the keyword topto get the current value of the iterator.

<s:iterator value="redemptionDetails">
    <s:property value="top[0].carrierId"/>
</s:iterator>
+2
source

All Articles