File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSTL parameters are not dereferenced Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL parameters are not dereferenced" Watch "JSTL parameters are not dereferenced" New topic
Author

JSTL parameters are not dereferenced

Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
I'm running JSTL 1.1 on Tomcat 5.0.28

At certain odd times (like now) my JSTL code no longer deferences expressions. In the following code:

<c:set var="hello" value="mdkdkdkdkdkdkdkdkd" />
<c ut value="${hello}" />


the output will be ${hello} ,

not mdkdkdkdkdkdkdkdkd as one would expect.

What would cause this?

Ah, the life of a jsp newbie...
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
It looks to me as though you have EL parsing disabled in your application - this is why the container isn't evaluating the ${ ... } expression and resolving it to the variable value (instead it's treating it as a literal string).

There are a couple of ways to ensure EL gets evaluated:

(1) Make sure your web.xml deployment descriptor is declared as being version 2.4 or higher

(2) Use <el-ignored>false</el-ignored> in the deployment descriptor, under a <jsp-property-group> (inside a <jsp-config>) which references the page in question.

(3) Use the page directive in the JSP: <%@ page isELIgnored="false" %>

The order of precedence is (3) overrides (2) overrides (1).

Since you're just starting JSP development, perhaps the easiest thing to do for (to avoid complications of conflicting configuration data) would be to use (3) in each experimental page. However, once it comes to writing applications intended to be deployed for real, you would probably want to use (1), or perhaps (2) to be explicit.

Regards,
Charles.

[ March 13, 2006: Message edited by: Charles Lyons ]
[ March 13, 2006: Message edited by: Charles Lyons ]

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

At certain odd times (like now)


By this do you mean that sometimes the same page works and sometimes it doesn't?

Or that it works on some pages, but not on others?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
Charles, thanks loads. Your advice (very detailed and impressive) have likely saved me HUGE amounts of time. I would not have figured out these solutions quickly. I will fiddle some more and see if I can get rid of the those explicit directives in the page itself. But for now they work, which is the most important thing.
Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
Oh, and Bear, your question still stands. Thanks. I am reminded that will have to ferret out those inconsistencies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL parameters are not dereferenced
 
Similar Threads
JSTL 1.1 and Tomcat 5 basic problem
Mixing JSTL and JSP?
New Line character in JSTL c:set
Formatting Currency Value in JSTL
Iteration of List in JSP