Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

JSTL config question

Thread view: 
Tobi - 01 Nov 2007 21:25 GMT
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:out 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!
Manish Pandit - 01 Nov 2007 21:35 GMT
> Hi-
>
[quoted text clipped - 27 lines]
>
> Thanks for any help!

c:out 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
Lew - 01 Nov 2007 23:18 GMT
> c:out 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:out) 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?

Signature

Lew

Manish Pandit - 02 Nov 2007 00:07 GMT
> > c:out is working fine, however, looks like EL is turned off for the
> > web-app.
[quoted text clipped - 13 lines]
> --
> Lew

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
Manish Pandit - 02 Nov 2007 00:09 GMT
> 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
Lew - 02 Nov 2007 00:20 GMT
> ... 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.
[quoted text clipped - 4 lines]
> 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.

Signature

Lew

Lew - 02 Nov 2007 00:22 GMT
>> The default value of isELIgnored varies depending on the version of
>> the web application deployment descriptor. The default mode for JSP
[quoted text clipped - 6 lines]
>
> This might be the source of the difficulty.

FWIW, I did not know this until the question was asked.  Knowing that Sun has
a Java EE tutorial I went there for the answer.  Not finding it right away, I
went to my fave search engine, which pointed me to the correct place in the
tutorial.  In other words, I did exactly what the OP could've done.

Signature

Lew

Manish Pandit - 02 Nov 2007 00:26 GMT
>  From the Java EE tutorial:
>
[quoted text clipped - 13 lines]
> --
> Lew

Ah! That explains it.

Thanks, Lew!

-cheers,
Manish
Tobi - 02 Nov 2007 13:50 GMT
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
Daniel Pitts - 02 Nov 2007 16:44 GMT
> 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.

Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

Lew - 02 Nov 2007 22:25 GMT
>> 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
[quoted text clipped - 5 lines]
> 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.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.