• 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 collection in jsp through JSTL

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scripting works [check below code]

But my need is to use JSTL to print collection value... Thanks in advance!

 
Sheriff
Posts: 67748
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The scriptlets are just here for testing, right?

So, what's the problem? If you don't tell use what's going wrong, how can we help? Please read ⇒ TellTheDetails and ItDoesntWorkIsUseless.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


"It just prints a crazy name and some numbers, with an @ all up in there."

If that guess is incorrect, ignore the rest starting now. You're doing different things in the two places: in one you're just dumping each entry. In the other you're doing something with specific info from each entry.
 
Rajeev roushan sharma
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The scriptlets are just here for testing, right?

So, what's the problem? If you don't tell use what's going wrong, how can we help? Please read ⇒ TellTheDetails and ItDoesntWorkIsUseless.



Problem is, scripting is printing the value of collection but when i tried the same with <c:foreach> JSTL tag it is not working. I don't want to use scripting in JSP to print value of collection. I will use only JSTL. Please let me know why my JSTL codes are not working.

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "it isn't working"? Is *anything* printing?
 
Rajeev roushan sharma
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:What do you mean by "it isn't working"? Is *anything* printing?



No errors, Not printing anything... Actually it is not looping through collection.
 
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
EL works with scoped variables.

If you want to reach the list from within your c:forEach tag, you'll need to bind it to scope.

 
Rajeev roushan sharma
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ben Souther wrote:EL works with scoped variables.

If you want to reach the list from within your c:forEach tag, you'll need to bind it to scope.



Thanks a lot Ben

Could you please let me know the same ? I mean how to bind that in scope...
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, right; missed that--just put it in any of the normal JSP scopes. If you're not sure what that is, take a step back and brush up on some JSP/EL basics before proceeding much further :)
 
reply
    Bookmark Topic Watch Topic
  • New Topic