• 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

EL with JSTL

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67746
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
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
Sheriff
Posts: 67746
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic