This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem using logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem using logic:iterate" Watch "Problem using logic:iterate" New topic
Author

Problem using logic:iterate

patriot indian
Greenhorn

Joined: May 20, 2009
Posts: 9
Hii,

i am a newbie to struts...currently using 1.1 version...i was trying to retrieve the data from database onto my jsp page but am having trouble...please help me out...i have a database and i have to retirve values form there into my jsp page ...here is what i am doing..
Action Class



The java bean is


and jsp is


On executing this i am getting error
No getter method for property ProposerID of bean collection


Please help me out.....
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The property is "proposerId" (note that the first character isn't capitalized).

I'm almost positive this isn't how you want to do it though--you're creating a collection of ActionForms. Normally there's a single ActionForm per action, and the ActionForm is passed automatically to the JSP. In y our case you'd have a list of users in the ActionForm, not a list of ActionForms.

(There is some debate whether or not ActionForms should be used solely for form data, or for *any* data for use on the page--I am of the former camp, but that's preference.)
patriot indian
Greenhorn

Joined: May 20, 2009
Posts: 9
hey thanks for the quick reply...but can you tell me how to solve this problem ...i need to get the entries from the databse into my jsp page...how exactly we will do that...currently i am able to pass the object into the arraylist...now i need to get the attributes(methods) to display them on the jsp...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You should be able to either add DB entries to a list (an array should also work) in an ActionForm, or create a separate collection and put it into request scope. From there use <c:forEach> (recommended) or if you're not using JSTL <logic:iterate>.
patriot indian
Greenhorn

Joined: May 20, 2009
Posts: 9
Can you show me a bit of working some pseudocode sort of thing so that i can use it..

Thanks in advance....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using logic:iterate