• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to print collection in jsp through JSTL  RSS feed

 
Rajeev roushan sharma
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Scripting works [check below code]

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

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66151
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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 :)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!