• 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

Not able to print the items in the List

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Soumya,

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

Anyway you solved it!

Regards,
Frits

 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic