[Logo]
Forums Register Login
Not able to print collection in jsp through JSTL

Scripting works [check below code]

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

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.


"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.
 
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.

What do you mean by "it isn't working"? Is *anything* printing?
 
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.
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.

 
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...
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 :)
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Oct 16, 2017 16:40:38.