wood burning stoves 2.0*
The moose likes JSP and the fly likes nested forEach 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 » Java » JSP
Bookmark "nested forEach " Watch "nested forEach " New topic
Author

nested forEach

Vinod Awar
Ranch Hand

Joined: Nov 06, 2006
Posts: 125
Hii all,

i want to display the result of a database query .In the servlet what i did is


and in the jsp i am trying to display them like this


But i can only see the columnnames. is there anything wrong in my nested forEach loop code

Thanks,
Vinod


The biggest bankruptcy is the loss of enthusiasm
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The problem isn't in your JSP.

You're only creating one "fields" object.
Move the declaration for your 'fields' object into the loop so a new one gets created for each row and try it again.



[BPSouther: fixed cut and paste error. Thanks Saif!]
[ March 15, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Ben Souther:



how about Swapping the second line with first line I though it becomes with more clear picture.. ;)


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Saif uddin:


how about Swapping the second line with first line I though it becomes with more clear picture.. ;)


Fixed. Thanks
Vinod Awar
Ranch Hand

Joined: Nov 06, 2006
Posts: 125
Thanks Ben and saif
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nested forEach