Discussions

Web tier: servlets, JSP, Web frameworks: Struts Iterator tag

  1. Struts Iterator tag (2 messages)

    Hi guys,
    I am facing a problem. The scenario is, I want to iterate a vector using logic:iterate tag and write a value in JspWriter using a bean:write tag which is embedded in a object that is stored in the vector.

    <logic:iterate id="list" name="listForm" property="vectorList">
    <bean:write name="list" property="name"/>
    </logic:iterate>
    I've tried in this way, where name is a property of a object that stored in the vectorList. But it doesn't print any thing since its looking for a nested property name in the vector. How i can over come this problem. I f some one has any idea abt it pls. help me.
    Thanks in advance

    Threaded Messages (2)

  2. Struts Iterator tag[ Go to top ]

    Use this way (type attribute to the logic:iterate tag) ....

    <logic:iterate id="list" name="listForm" property="vectorList" type="yourclassname">
    <bean:write name="list" property="name"/>
    </logic:iterate>

    hope it helps ....
  3. type[ Go to top ]

    You shouldn't use the type attribute unless you need to access the element directly in a scriptlet.

    <logic:iterate name="mybean" property="vectorProperty" id="element">
      <bean:write name="element" property="name"/>
    </logic:iterate>

    Should work fine as long as you have an Object called "mybean" in context with a getVectorProperty() method.