JSP, Tomcat 5 and EL

E

Erik Pragt

Hello everyone,

Currently I'm testing JSTL, but I'm having some troubles with my Tomcat 5
configuration. I have a very simple page:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>Dit is een testje</title>
<head>

<body>
<c:forEach var="i" begin="1" end="5" step="1">
<c:eek:ut value="${i}" />
<br />
</c:forEach>

<c:eek:ut value="erik" />
</body>
</html>

But instead of getting the values of 'i', $i is printed...

Thus, the output is:

....

<body>
${i}
<br />
${i}
<br />
${i}
<br />
${i}
<br />
${i}
<br />
erik
</body>

....

Can someone please help me with this?

Thanks in advance,

Erik Pragt
 
C

Christophe Vanfleteren

Erik said:
Hello everyone,

Currently I'm testing JSTL, but I'm having some troubles with my Tomcat 5
configuration. I have a very simple page:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>Dit is een testje</title>
<head>

<body>
<c:forEach var="i" begin="1" end="5" step="1">
<c:eek:ut value="${i}" />
<br />
</c:forEach>

<c:eek:ut value="erik" />
</body>
</html>

But instead of getting the values of 'i', $i is printed...

Thus, the output is:

...

<body>
${i}
<br />
${i}
<br />
${i}
<br />
${i}
<br />
${i}
<br />
erik
</body>

...

Can someone please help me with this?

Thanks in advance,

Erik Pragt

You need to use the "RT" versions of the JSTL with JSP 2 (which is what comes
with tomcat 5).

So declare your taglib as follows:
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

Also, in jsp 2, you now can type your example as

<c:forEach var="i" begin="1" end="5" step="1">
${i}
<br />
</c:forEach>
<c:eek:ut value="erik" />

As you can see, you can use the EL outside of the tags.
 
E

Erik Pragt

So declare your taglib as follows:
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

Also, in jsp 2, you now can type your example as

<c:forEach var="i" begin="1" end="5" step="1">
${i}
<br />
</c:forEach>
<c:eek:ut value="erik" />

As you can see, you can use the EL outside of the tags.


Great, this works! But what exactly is the difference between the _rt
version, and the 'normal'(?) version?
Currently, I'm working on Tomcat 5, but my company only uses iPlanet 4.1. Is
it possible to use JSTL with iPlanet 4.1? And which version should I use
then?

Erik

(ps, sorry I'm so full of questions...)
 
C

Christophe Vanfleteren

Erik said:
Great, this works! But what exactly is the difference between the _rt
version, and the 'normal'(?) version?
Currently, I'm working on Tomcat 5, but my company only uses iPlanet 4.1.
Is it possible to use JSTL with iPlanet 4.1? And which version should I use
then?

The "normal" version :). The difference between the two lies in the fact that
with the normal version the tags interpret the EL themselves. The RT version
doesn't do that (it doesn't support the EL at all actually). But the
confusing part is, that since the EL is supported by the JSP pages
themselves in JSP 2, you can't use the tags that support the EL themselves
anymore :)

But it might be safer for you to use tomcat 4.1.X, because otherwise you
might end up using jsp 2 features that will not be available under iPlanet
4.1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top