File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Looping problem in the display. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Looping problem in the display." Watch "Looping problem in the display." New topic

Looping problem in the display.

Romeo Ranjan
Ranch Hand

Joined: Feb 23, 2009
Posts: 95
Dear ALL,

I am not able to get the display that I am expecting.This is my output

What I am expecting is

I am really not able to see where I am going wrong. Any hint please.

SCJP 6.0
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30085

You have a loop around <td> in your JSP. What are you expecting it to do?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Liangfeng Ren

Joined: Jul 28, 2010
Posts: 7
Remove the <tr> and </tr> outside <c:forEach></c:forEach>

Ngoc Sinh

Joined: Jul 29, 2010
Posts: 3
As I understand, you have a list of author. Each author has some value name, id, and of list of something. You want to print all information about an author in a row.

If I understand was right, so I think each author must have a different key value. I am a little confused with these code

If it is different record, you should let another variable be the key.

In addition, the looping code you used are also confused. You put a <tr> inside another <tr>, this is not a valid html code.

If I am not wrong, the html code of your table in the generated html should be like this:

Lastly, I think you should check the output HTML code, so that you can see that there are many error in the generated html code and I hope it will help you solve the problem.
I agree. Here's the link:
subject: Looping problem in the display.
Similar Threads
Matching two map values : An exception occured trying to convert String "A" to type "java.lang.Long"
jstl + forEach + x number of items per row
JSP column name hyperlink help
Display of hashmap values using jstl
Iterating over nested collections