FAQ
United Rentals
Consider it done.™
800-UR-RENTS
unitedrentals.com

Search Discussions

  • Wendy Smoak at Nov 10, 2006 at 8:09 pm

    On 11/10/06, Van Nguyen wrote:

    I have two ArrayList that I need to iterate through:
    <logic:iterate id="line" indexId="indexId" name="collection1">
    <bean:write name="line" />
    // write info contained in collection2
    // something like this… but not working??
    <bean:write name="collection2[indexed]" />
    </logic>

    collection1 and collection2 will always have the same number of records…
    That you need to do this probably means "two ArrayLists" is the wrong
    data structure. How about a single array list of some object that has
    two properties? Or a Map? I can't tell what you're doing from the
    contrived example.

    If you must do it, <logic:iterate> exposes the current index as
    'indexId' which might help.

    http://struts.apache.org/1.x/struts-taglib/tlddoc/logic/iterate.html

    --
    Wendy

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Ed Griebel at Nov 10, 2006 at 8:10 pm
    Try using <bean:write name="collection2[indexId]" />. indexId should
    be replaced with 0, 1, 2, ... as it iterates and the underlying
    BeanUtils will extract the n-th element from the collection. I don't
    think this will if you are using an unsorted collection (set, map)
    because they don't support get(int)

    On 11/10/06, Van Nguyen wrote:




    Hi,



    I have two ArrayList that I need to iterate through:



    <logic:iterate id="line" indexId="indexId" name="collection1">

    <bean:write name="line" />

    // write info contained in collection2

    // something like this… but not working??

    <bean:write name="collection2[indexed]" />

    </logic>



    collection1 and collection2 will always have the same number of records…



    Any ideas?


    United Rentals
    Consider it done.™
    800-UR-RENTS
    unitedrentals.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Uday Karrothi at Nov 11, 2006 at 4:28 am
    Even you ar settign all the values properly and getting the display
    accurately. I do not think the changes you made to the Collection( in terms
    of textboxes or checkboxes or Selections) will not reflect on the arrayList.
    Atleast I failed in doing so. There are other ways liek using multiboxes,
    indexing the properties etc.

    i hope that was useful. I could give you examples but I am not sure if I am
    addressing the problem right.

    regards,
    Uday Karrothi
    On 11/10/06, Ed Griebel wrote:

    Try using <bean:write name="collection2[indexId]" />. indexId should
    be replaced with 0, 1, 2, ... as it iterates and the underlying
    BeanUtils will extract the n-th element from the collection. I don't
    think this will if you are using an unsorted collection (set, map)
    because they don't support get(int)

    On 11/10/06, Van Nguyen wrote:




    Hi,



    I have two ArrayList that I need to iterate through:



    <logic:iterate id="line" indexId="indexId" name="collection1">

    <bean:write name="line" />

    // write info contained in collection2

    // something like this… but not working??

    <bean:write name="collection2[indexed]" />

    </logic>



    collection1 and collection2 will always have the same number of records…



    Any ideas?


    United Rentals
    Consider it done.™
    800-UR-RENTS
    unitedrentals.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Uday Karrothi at Nov 13, 2006 at 12:02 am
    sorry wrong thread reply

    regards,
    Uday Karrothi
    On 11/10/06, Uday Karrothi wrote:

    Even you ar settign all the values properly and getting the display
    accurately. I do not think the changes you made to the Collection( in terms
    of textboxes or checkboxes or Selections) will not reflect on the arrayList.
    Atleast I failed in doing so. There are other ways liek using multiboxes,
    indexing the properties etc.

    i hope that was useful. I could give you examples but I am not sure if I
    am addressing the problem right.

    regards,
    Uday Karrothi
    On 11/10/06, Ed Griebel wrote:

    Try using <bean:write name="collection2[indexId]" />. indexId should
    be replaced with 0, 1, 2, ... as it iterates and the underlying
    BeanUtils will extract the n-th element from the collection. I don't
    think this will if you are using an unsorted collection (set, map)
    because they don't support get(int)

    On 11/10/06, Van Nguyen wrote:




    Hi,



    I have two ArrayList that I need to iterate through:



    <logic:iterate id="line" indexId="indexId" name="collection1">

    <bean:write name="line" />

    // write info contained in collection2

    // something like this… but not working??

    <bean:write name="collection2[indexed]" />

    </logic>



    collection1 and collection2 will always have the same number of records…


    Any ideas?


    United Rentals
    Consider it done.™
    800-UR-RENTS
    unitedrentals.com



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesstruts
postedNov 10, '06 at 7:57p
activeNov 13, '06 at 12:02a
posts5
users4
websitestruts.apache.org
irc#struts

People

Translate

site design / logo © 2022 Grokbase