views:

13

answers:

0

Hello all,

I do the following to return a list contains 2 objects for each item.

public List getList(int id) {
            open();
            // TODO Auto-generated method stub
            List l = session.createSQLQuery("select poDetail.*,quantity*unitPrice as total from poDetail where poDetail.poID="+id)
            .addEntity("poDetail", model.PoDetail.class)
            .addScalar("total", Hibernate.FLOAT)
            .list();

            session.close();
            return l;
    }

I want to use struts "s:iterator" tag to show the result.

In the past I just wrote as in the following to show in a jsp file:

    <s:iterator value="actionPoDetails.myList" status="st">
                                            <tr <s:if test="#st.odd">style="background-color:#dddddd"</s:if>
                                                    <s:else>style="background-color:#eeeeee"</s:else>>

                                                    <td><s:property value="id" /></td>
                                                    <td><s:property value="orgID" /></td>
                                                    <td><s:property value="total" /></td>
                                                    <td><s:property value="product.name" /></td>
                                                    <td><s:property value="product.partNum" /></td>
                                                    <td><s:property value="product.unit" /></td>

:
:
:

However, it is not so easy now as the list is a combined list as each list item contains a PoDetail class and a Float class.

So could anyone tell me how to convert the list returned in order to show by struts iterator tag?

Thanks!