jsp struts: logic:iterator

Discussions

XML & Web services: jsp struts: logic:iterator

  1. jsp struts: logic:iterator (3 messages)

    Hi,

    I'm new to struts, and am trying to use the logic:iterator tag.

    My ActionForm had a property 'billList', containing a Collection of objects. Through the logic:iterate I want to display a list of some of the data from the bills.

    I have problems getting to the data however. I have tried a number of combinations of id, name and property arguments of the tag, but not getting the results I want.

    How would the tag be implemented?

    Regards,

    Felix
  2. Let Say, you have a VO, UserVO which contains name, age. Here is the code to display the name and age.


          <logic:iterate id="user" name="userList" name="usersForm" property="usersList" type="UserVO">
           <TR>
            <TD CLASS="VALUE" ALIGN="left">&nbsp;
                <bean:write name="user" property="name"/>
            </TD>
            <TD CLASS="VALUE" ALIGN="left">&nbsp;
                <bean:write name="user" property="age"/>
            </TD>
           </TR>
          </logic:iterate>


    Here name in iterate is the name of your form, usersList is a property that returns a list of UserVO.


    UserVO is a bean, which has name and value attaributes and its getter& setters.

    Hope this helps,
    Senthil.
  3. <logic:iterate id="user" name="userList" name="usersForm" property="usersList" type="UserVO">
    Sorry, there is a mistake, please ignore name="userList"

    Thanks,
    Senthil.
  4. HI I m getting error java.lang.ClassCastException: java.util.ArrayList for above tag Let mee more Clear VO have two field name and empCode Actionform have getter and setter for someList and in Action class I m adding VO to someList..