aspose file tools*
The moose likes Struts and the fly likes how to iterate a collection of data objects using <logic:iterate> and <bean:write> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to iterate a collection of data objects using <logic:iterate> and <bean:write>" Watch "how to iterate a collection of data objects using <logic:iterate> and <bean:write>" New topic
Author

how to iterate a collection of data objects using <logic:iterate> and <bean:write>

Bushra Binte
Ranch Hand

Joined: Nov 07, 2006
Posts: 60
Hi,I am trying to iterate a collection of objects.These objects contains 5 fields to be displayed.
In action class,i put the collection as

And in jsp ,iterate as



When i run the application no error is displayed ,but ,result is,

[object][object][object][object][object]

displayed.

How can we get the value stored inside the object that is in a collection.

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Well this is a strange sort of behavior. First of all I am assuming that you have getter properties for all your properties in RegD class. Then one thing that I'm not clear on is that why are you using a list when there is only one instance of RegD class in the list. Maybe you have shown some incomplete code.

Also by looking at the ouput, I can only think of the toString method of AbstractCollection class. I know I may be wrong on this. But there is no way that I know of when the code should display that kind of output. Maybe there is something wrong with your action and there is a List as elements in your list. Still I'm not sure how can that sort of output can come...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to iterate a collection of data objects using <logic:iterate> and <bean:write>