• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL with JSTL

 
Abhijeet Gholkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
Iam using jstl for the first time. Iam using tomcat 5.0.25. When i try to use EL with some tag say <c ut/> the whole thing ${....} is sent to the ouput buffer.
Take for e.g. the code given below:
<c:forEach var="i" begin="1" end="10" step="1">
<c ut value="${i}" /><br />
</c:forEach>

It prints ${i} 10 times..
looking forward for help...

Thanks

[ EJFH: Disabled smilies for this post so code looks OK ]
[ July 19, 2004: Message edited by: Ernest Friedman-Hill ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you're using JSTL 1.0 syntax in a 1.1 container which may be what causes the problems you're experiencing.
Try using just ${i} instead of <cut value="${i}"/> and see what happens
 
Abhijeet Gholkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jeroen

I tried doing that. I used just ${i}, but it gives me the same result.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm, weird.
I've done something similar quite often but don't use the var attribute.

works fine, I use it to create the elements of a <select> containing month numbers with the currently selected month being set in the pageContext.

Note this is for JSTL 1.0 (we're aiming at the moment for Tomcat 4 as Tomcat 5 was not released when development began and T4 is what some of our customers are using already).

[ July 16, 2004: Message edited by: Bear Bibeault ]
[ July 16, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your web.xml declare the web app as a Servlet 2.4 web app? Tomcat 5 doesn't "turn on" JSP 2.0 features unless you do.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you're using JSTL 1.0 syntax in a 1.1 container


There is nothing wrong with the syntax. It is valid for both JSTL 1.0 and JSTL 1.1.

And... when posting code, be sure to click the "disable smilies" checkbox near the bottom of the page. That way, your <cut> tags will look less surprised.
[ July 16, 2004: Message edited by: Bear Bibeault ]
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Does your web.xml declare the web app as a Servlet 2.4 web app? Tomcat 5 doesn't "turn on" JSP 2.0 features unless you do.


I concur with this assumption. It bit me when I started using EL too.

BTW - Here is the 2.4 declaration in case...


[ July 18, 2004: Message edited by: Gregg Bolinger ]
 
Abhijeet Gholkar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys its working now. I had to add the attribute version = 2.4 to the web-app tag. Thanks a lot.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic