Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic iterate something wrong

 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Vicky Mohan
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
and did'nt work
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pranav Sharma
Ranch Hand
Posts: 258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that was it!!!
a little more info in the error would have been great.. but hey alls well that ends working...

thanks Marc
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic