Struts <logic:iterate>

Discussions

Web tier: servlets, JSP, Web frameworks: Struts <logic:iterate>

  1. Struts <logic:iterate> (5 messages)

    Hello,

    <logic:iterate id="vect1" collection="<%=vect%>" indexId="ijk">

    <bean:write name="vect1" property="firstName" />

    </logic:iterate>

    The above code shows that I have a vector "vect" of objects and "firstName" is the property of the object. However, the <bean:write> does not show the value of the property "firstName".

    What can be the possible solution?

    Regards,

    Medha

    Threaded Messages (5)

  2. Struts <logic:iterate>[ Go to top ]

    Medha:

    > <logic:iterate id="vect1" collection="<%=vect%>" indexId="ijk">
    >
    > <bean:write name="vect1" property="firstName" />
    >
    > </logic:iterate>


      I see a glitch in your code snippet. the section <%=vect%> is not what you are looking for. If you dry run through this code, then i guess the result should be the toString() representation of your vect object as a value for collection.

      Run you code and do view source in your browser. the logic tag is not getting proper collection handle is the problem.

    Regards
    Chetan
  3. Struts <logic:iterate>[ Go to top ]

    I guess you cant use "<% xxxxxx %. within any struts tags.

    reg
    ashok
  4. Struts <logic:iterate>[ Go to top ]

    Medha:

    > <logic:iterate id="vect1" collection="<%=vect%>" indexId="ijk">
    >
    > <bean:write name="vect1" property="firstName" />
    >
    > </logic:iterate>


      I see a glitch in your code snippet. the section <%=vect%> is not what you are looking for. If you dry run through this code, then i guess the result should be the toString() representation of your vect object as a value for collection attribute in logic:iterate tag.

      Run your code and do view source in your browser. the logic tag is not getting proper collection handle is the problem.

     One more important thing is, if you post your queries on apache site then you will get more immd. response for your struts related queries.

    http://jakarta.apache.org/struts/faqs/index.html try this site.
    or subscribe to apache-struts maililing list where you will get lot of help.

    Regards
    Chetan


    Regards
    Chetan
  5. Try[ Go to top ]

    I haven't tried iterating through a vector, but I use the following for an ArrayList:

    <logic:iterate id="items" name="beanName" property="ArrayListName">
    <bean:write name="items" property="ArrayListMemberAttribute" />
    </logic:iterate>

    This iterates through an ArrayList of objects and writes the appropriate getter. In my case "ArrayListMemberAttribute" is actually "modelnum."

    So, I'd suggest actually referencing vect instead of writing it between the quotes.

    Hope this helps,
    Jeremy
  6. r u prasas vyas,solapur's sister. please mail me at girish_ahankari at yahoo dot com
    HI iam girish ahankari s/o sulochana ahankari.