JSTL config question

T

Tobi

Hi-

I'm using 5.0.28 Tomcat with JSTL 1.1, and am having problems
rendering the variables.

I have declared: <%@taglib prefix="c" uri="http://java.sun.com/jsp/
jstl/core" %> in the JSP.
I have added the c.tld to WEB-INF/tld, as well as standard.jar and
jstl.jar to WEB-INF/lib. I did not declare the
tag lib in web.xml.

For this bit of code:

<%-- Save data with html tags --%>
<c:set var="msg" value="hi <b>John</b>!" scope="page" />
<%-- Show the value after translating special characters --%>
<c:eek:ut value='${msg}' />

An exception is not thrown in Tomcat, it merely outputs:

${msg}

Has anyone had experience using JSTL 1.1 on Tomcat 5.0.28? In the
notes it the version it was successfully tested on was 5.0.3-so I'm
wondering if it's a version issue, if there is something else
fundamental going on. Unfortunately the Tomcat version can't be
changed-otherwise I would upgrade.

:-/

Thanks for any help!
 
M

Manish Pandit

Hi-

I'm using 5.0.28 Tomcat with JSTL 1.1, and am having problems
rendering the variables.

I have declared: <%@taglib prefix="c" uri="http://java.sun.com/jsp/
jstl/core" %> in the JSP.
I have added the c.tld to WEB-INF/tld, as well as standard.jar and
jstl.jar to WEB-INF/lib. I did not declare the
tag lib in web.xml.

For this bit of code:

<%-- Save data with html tags --%>
<c:set var="msg" value="hi <b>John</b>!" scope="page" />
<%-- Show the value after translating special characters --%>
<c:eek:ut value='${msg}' />

An exception is not thrown in Tomcat, it merely outputs:

${msg}

Has anyone had experience using JSTL 1.1 on Tomcat 5.0.28? In the
notes it the version it was successfully tested on was 5.0.3-so I'm
wondering if it's a version issue, if there is something else
fundamental going on. Unfortunately the Tomcat version can't be
changed-otherwise I would upgrade.

:-/

Thanks for any help!

c:eek:ut is working fine, however, looks like EL is turned off for the
web-app.

Add this to the page:

<%@ page isELIgnored="false" %> and you should be good to go.

-cheers,
Manish
 
L

Lew

Manish said:
c:eek:ut is working fine, however, looks like EL is turned off for the
web-app.

Add this to the page:

<%@ page isELIgnored="false" %> and you should be good to go.

I put the OP's two lines (c:set and c:eek:ut) into a JSF page here and they
worked just fine. Alas, I'm using Tomcat 6.0.14.

I did not set <%@ page isELIgnored="false" %> but it still worked. Nor did I
declare any TLD.

Could there be something in the web.xml turning it off?
 
M

Manish Pandit

I put the OP's two lines (c:set and c:eek:ut) into a JSF page here and they
worked just fine. Alas, I'm using Tomcat 6.0.14.

I did not set <%@ page isELIgnored="false" %> but it still worked. Nor did I
declare any TLD.

Could there be something in the web.xml turning it off?

This has always confused me - even though the Spec says that in JSP
2.0 EL is turned "on" by default (isElIgnored="false"), I never got my
EL expressions to work under Tomcat 5.0/5.5 unless I added the
isElIgnored=true in the @page directive.

To turn it on/off at the application level, here is the web.xml
fragment :

<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config>

-cheers,
Manish
 
M

Manish Pandit

unless I added the
isElIgnored=true in the @page directive.

Sorry - I meant isELIgnored=false in the @page directive. Eventually I
ended up setting it at web.xml level, as I was tired to put this in
every JSP :)

-cheers,
Manish
 
L

Lew

Manish said:
... isELIgnored=false in the @page directive. Eventually I
ended up setting it at web.xml level, as I was tired to put this in
every JSP :)

From the Java EE tutorial:
The default value of isELIgnored varies depending on the
version of the web application deployment descriptor.
The default mode for JSP pages delivered with a Servlet 2.4 descriptor
is to evaluate EL expressions; this automatically provides the default
that most applications want.
The default mode for JSP pages delivered using a descriptor from
Servlet 2.3 or before is to ignore EL expressions;
this provides backward compatibility.
<http://java.sun.com/javaee/5/docs/tutorial/doc/bnahq.html#bnaic>

This might be the source of the difficulty.
 
T

Tobi

Thanks everyone for your thoughts, unfortunately, neither of those
options worked, leading me to wonder if it is a 1.0 vs 1.1 JSTL. I'll
try switching it out and testing it.


Tobi
 
D

Daniel Pitts

Tobi said:
Thanks everyone for your thoughts, unfortunately, neither of those
options worked, leading me to wonder if it is a 1.0 vs 1.1 JSTL. I'll
try switching it out and testing it.


Tobi
Generally, its a good idea to leave in the context of the post you're
replying too. Someone like who didn't read the original posts wouldn't
be able to easily help you further.
 
L

Lew

Daniel said:
Generally, its a good idea to leave in the context of the post you're
replying too. Someone like who didn't read the original posts wouldn't
be able to easily help you further.

I'm curious as to the results of the OP's test on the JSTL version. It
shouldn't matter, I'd think.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top