File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes logic iterate something wrong Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic iterate something wrong" Watch "logic iterate something wrong" New topic
Author

logic iterate something wrong

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
in my action:
I have an arrayList(called names) of objects. and i set this arraylist in my form.

in my jsp i do this:
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
Can you attach the exact error message that gets printed in the console so that it would get a better idea of what is going wrong here ??
[ August 25, 2005: Message edited by: Mohen Vijay ]
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
DO you have an attribute name in your object ??

Try giving the TYPE attribute in logic:iterate, that may help to cast it to the right object..
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
yes.
and did'nt work
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I think that when you are submitting the page, the arrayList is no longer full of name objects (I'm assuming you are using request scope). So Struts says, "Give me name #x from the arrayList so I can call setName() on it. What? There's no object? Exception!"

Here's a few methods for getting around this problem.


A good workman is known by his tools.
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
that was it!!!
a little more info in the error would have been great.. but hey alls well that ends working...

thanks Marc
 
Consider Paul's rocket mass heater.
 
subject: logic iterate something wrong
 
Similar Threads
how to apply continue statement in struts logic:iterate tag
Logic iterate
Regarding Logic iterate
Nested tag problem
nested logic:iterate