Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSP
How to use multiple forEach Loops in EL?
aatish pandya
Greenhorn
Posts: 21
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<body> <jsp:useBean id="person" class="pack3.Person" scope="request"/> <table border="1"> <tr> <td>name</td> <td>phone</td> </tr> <c:forEach var="message" items="${person.name}"> <c:forEach var="message2" items="${person.phone}"> <tr> <td> ${message} </td> <td> ${message2} </td> </tr> </c:forEach> </c:forEach> </table> </body>
Output - Duplicate Records, see attachment!
CT_OtPt.jpg
Output
Piyush Joshi
Ranch Hand
Posts: 207
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You just have to place your <td>'s at right places. Besides it usage of forEach is just fine.
Piyush
aatish pandya
Greenhorn
Posts: 21
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dear Piyush,
I have tried all possible combinations for the forEach as well as the TD's, but the output's are abnormal. I have attached 2 such output's. Can you help getting it right please?
CT_OtPt.jpg
op1
CT_OtPt_Nk.jpg
op2
Piyush Joshi
Ranch Hand
Posts: 207
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think this should work:
<body> <jsp:useBean id="person" class="pack3.Person" scope="request"/> <table border="1"> <tr> <td>name</td> <td>phone</td> </tr> Edit: //Code Removed // Go by Bear's way. It will teach you where to look for, if similar problem comes in future. </table> </body>
Piyush
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Have you
looked
at the HTMl that is being produced? That will tell you what's wrong.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
serve html
EL in not working
Answer this if you know EL
HashMap Output to Datatable
Complex Table and JSTL
More...