File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL not working on my Tomcat test environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL not working on my Tomcat test environment" Watch "EL not working on my Tomcat test environment" New topic

EL not working on my Tomcat test environment

Phil Meyer

Joined: Nov 13, 2006
Posts: 10
Hey guys.

I'm hard at work studying for my SCWCD test.

I've gone through the book once, with my highliter, and now on my second time through I am trying everything out on the Tomcat test environment the book has you deploy to. I've gotten servlets and simple JSPs to work just fine, and I've been having fun. I recently started messing around with the JSTL, and have started trying to use the EL.

The JSTL tags work just fine, but the EL language appears to do nothing. My EL expressions just show up on my pages as they were written into the JSP.

For example:

${7} ends up being ${7} on my web-page. Same thing for trying to access my attributes.

I'm using Tomcat 5.5.20, according to what prints when I start it up. I've been trying to trouble-shoot this, and so was afraid the JSP jar in Tomcat wasn't 2.0. I downloaded a jsp-api-2.0 jar, and replaced the jar in my [TOMCAT_HOME]/common/lib directory, but nothing changed. I think the Tomcat 5.X versions all use JSP 2.2, so that didn't surprise me.

The Head First book mentioned that EL is enabled by default, but just in case, I put the <el-ignored> JSP property in my web.xml and set it to false. Still no change, also not a surprise.

Anyone know what might be wrong? I suspect the problem is just a stupid mistake I am making.

Thank you in advance.
Carol Enderlin
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
What's your web.xml look like? Make sure it specifies servlet version 2.4 as described in the FAQ.

From ElOrJstlNotWorkingAsExpected:

Note: even though you can use the Servlets 2.3 DOCTYPE with a JSP 2.0 container, this will put the container into "compatibility mode" and the the EL will be disabled on the JSP pages.
Phil Meyer

Joined: Nov 13, 2006
Posts: 10
Thanks Carol, I thought for sure your answer would help things. My web.xml didn't have the same web-app tag as the one they list. So I changed it.

Here is my current web.xml:

I was sure that would fix the problem, from the FAQ. Unfortunately, I have the same problem.

I then thought perhaps the issue is that I have the wrong JSTL jar, so I downloaded the 1.1 jar, and put that in my web-project's lib directory. I thought there was a chance that could fix it, but it didn't.

So I'm still stuck. I'll go back to trouble-shooting this later tonight or tomorrow, perhaps I will find something. If anyone has any input in the mean time, I'd be more than thankful.
Phil Meyer

Joined: Nov 13, 2006
Posts: 10

Okay, I figured it out. I just needed to change my JSP, so that it would recompile, and then use the EL.

Thanks so much Carol!
Sayak Banerjee
Ranch Hand

Joined: Nov 28, 2006
Posts: 292
Though Tomcat is a friendly container and you generally don't have to redeploy the application after making changes, you're better off redeploying the application after any changes made(to a JSP or whatever). You would, at least, not come across issues like these.

Turn on, tune in, drop out.
I agree. Here's the link:
subject: EL not working on my Tomcat test environment
It's not a secret anymore!