aspose file tools*
The moose likes JSP and the fly likes EL with JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "EL with JSTL" Watch "EL with JSTL" New topic
Author

EL with JSTL

Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
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

Joined: Oct 12, 2000
Posts: 5093
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


42
Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
hi Jeroen

I tried doing that. I used just ${i}, but it gives me the same result.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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

Joined: Jan 10, 2002
Posts: 61001
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61001
    
  65

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

Joined: Jul 11, 2001
Posts: 15299
    
    6

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 ]

GenRocket - Experts at Building Test Data
Abhijeet Gholkar
Greenhorn

Joined: Jun 11, 2002
Posts: 25
Thanks guys its working now. I had to add the attribute version = 2.4 to the web-app tag. Thanks a lot.
 
Don't get me started about those stupid light bulbs.
 
subject: EL with JSTL