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

J

John

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
 
A

Andrea Francia

John said:
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();
}
 
R

Roedy Green

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top