How to iterate 2 nested collections w <logic:iterate> without a"getter"

Discussion in 'Java' started by John, Mar 31, 2008.

  1. John

    John Guest

    Hi all,
    I have to work on a third party jar-file that gives me some
    headache...

    I have an ArrayList<E> of some objects in my ActionForm - so iterating
    through this ArrayList is not a problem: I just use logic:iterate in
    the usual way, piece of cake :)

    BUT: the objects within the ArrayList contain a method that returns an
    object of type Iterator (so also this would be a piece of cake to
    iterate), but the method that returns this Iterator object is not a
    "getter".

    The signature of the method is:

    public java.util.Iterator modifiers()

    ----->Iterates over the modifiers.

    My BIG trouble is that the method is not called "getModifiers", so I'm
    stuck in with my nested double <logic:iterate>, because struts tells
    me "there is no getter for bean xXXX - for the nested object.
    I suppose it is because Struts looks after a method in the bean
    beginning with "get". Since it does not begin with "get" , Struts
    cannot iterate through this Iterator object, and I cannot extract the
    necessary informations.

    Does anybody know how to process such an Iterator with a method that
    does not begin with "get"? Any suggestions?

    Thank you very much for your suggestions - I'm quite in trouble
    because of that...
    John
    John, Mar 31, 2008
    #1
    1. Advertising

  2. Re: How to iterate 2 nested collections w <logic:iterate> withouta "getter"

    John wrote:
    > Does anybody know how to process such an Iterator with a method that
    > does not begin with "get"? Any suggestions?

    I don't know struts.
    The only idea that I have is: wrap the object with a class that has a
    getModifiers() method like that:

    Iterator getModifiers() {
    return wrapped.modifiers();
    }

    --
    Andrea Francia
    http://www.andreafrancia.it/
    Andrea Francia, Mar 31, 2008
    #2
    1. Advertising

  3. John

    Roedy Green Guest

    Re: How to iterate 2 nested collections w <logic:iterate> without a "getter"

    On Mon, 31 Mar 2008 12:38:59 -0700 (PDT), John
    <> wrote, quoted or indirectly quoted
    someone who said :

    >Does anybody know how to process such an Iterator with a method that
    >does not begin with "get"? Any suggestions?


    You would have to make the class implement Iterable perhaps by
    extending it.
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Mar 31, 2008
    #3
  4. Chase Preuninger, Apr 1, 2008
    #4
  5. RedGrittyBrick, Apr 1, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gogo
    Replies:
    1
    Views:
    2,074
    Sudsy
    Sep 4, 2003
  2. jc1771
    Replies:
    2
    Views:
    1,009
    jc1771
    Sep 10, 2003
  3. Doug Poland
    Replies:
    9
    Views:
    705
    VisionSet
    Sep 27, 2003
  4. runescience
    Replies:
    0
    Views:
    1,428
    runescience
    Feb 9, 2006
  5. sibasish
    Replies:
    0
    Views:
    864
    sibasish
    Mar 21, 2006
Loading...

Share This Page