• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to print the items in the List

 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,

In my servlet I'm setting a list variable in session and trying to loop through the list and print values in JSP.
From the output it looks like it is not iterating through the list. (I don't see any checkbox data/value)
Please let me know what I'm I doing wrong.

Below is the JSP code snippet.


Thanks,
Soumya.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the HTML source to verify that it's not iterating?

It could just be that you're creating malformed HTML



Note the </tr> tag inside the loop.
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Ben. A small correction to my previous posting. I don't see the data items in the list being printed but I do see the name of the list "localeList"
printed next to the check box

I looked at the source code and it is not iterating over the List. Below is part of the souce code.


 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2686
156
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Soumya,

Just to check that your list contains items change your forEach into:


What does it give you as an output?

Regards,
Frits
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Frits. I made those changes and I don't see anything printed. Below source code from the JSP.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2686
156
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soumya,

It seems your list only contains one value.
Can you show me how you create the localeList and how you put it as an attribute to the session.

Regards,
Frits
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits,

Below is the code for populating the list.


After this method, I set it in the session.


Please let me know where I'm I making the mistake.
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick update. I cleared the cache and it is working!

Thanks for all your guidance.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2686
156
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soumya,

That is always the last thing you can think of. Those browsers...

Anyway you solved it!

Regards,
Frits

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!