Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

EL with JSTL

 
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 ]
 
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 <c:out 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 ]
 
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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 <c:out> tags will look less surprised.
[ July 16, 2004: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • 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.
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic