Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

nested forEach  RSS feed

 
Vinod Awar
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:



how about Swapping the second line with first line I though it becomes with more clear picture.. ;)
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben and saif
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!