2

I am running tomcat7 on an Amazon EC2 Linux instance. For some reason that I cannot figure out, the jstl ${} syntax is not getting processed. What is weird, at least in my mind, is that the <c:forEach /> tags are getting processed correctly.

So for example, I have this in my jsp

<c:forEach items="${flavors}" var = "f">
    ${f.value}
</c:forEach>

And this is what is getting printed on my page : ${f.value}.

So, the <c:forEach /> tag does not get printed out but the ${} synatax does.

I have verifed that there are 4 elements in the flavors list by viewing them with <%= request.getAttribute("flavors")%>.

Any idea what is going on and how to fix this?

Thanks!

EDIT: Added relevant portion of my pom.xml

<dependency>
  <groupId>jstl</groupId>
  <artifactId>jstl</artifactId>
  <version>${jstl.version}</version>
</dependency>


<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.glassfish.web</groupId>
  <artifactId>jstl-impl</artifactId>
  <version>1.2</version>
  <exclusions>
    <exclusion>
      <artifactId>servlet-api</artifactId>
      <groupId>javax.servlet</groupId>
    </exclusion>
    <exclusion>
      <artifactId>jsp-api</artifactId>
      <groupId>javax.servlet.jsp</groupId>
    </exclusion>
  </exclusions>
</dependency>
jlars62
  • 7,183
  • 7
  • 39
  • 60

2 Answers2

2

pl add following attribute to top of jsp. <%@ page isELIgnored="false" %>

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
Sanjay
  • 2,481
  • 1
  • 13
  • 28
0

You need the JSTL libraries on your tomcat lib. Refer to the links below: Running JSTL on Tomcat 7 and download from: Tomcat JSTL libraries dowload Also here: Tomcat 7 and JSTL

Community
  • 1
  • 1
zulqarnain
  • 1,695
  • 1
  • 16
  • 33
  • The only dependency from the blog I was missing was the glassfish one, and I added it, rebuilt the war, deployed it, and nothing changed. – jlars62 Mar 28 '15 at 22:39
  • I am not sure if that last link you shared applies because tomcat is having no problems with `http://java.sun.com/jsp/jstl/core` – jlars62 Mar 28 '15 at 22:40
  • Did you follow the entire answers on the 3rd link. Check the solution with score 38. You have the 2 exclusions but not the 3rd ` jstl-api javax.servlet.jsp.jstl ` I think you should also show your `web.xml` if you still having problems. – zulqarnain Mar 28 '15 at 22:55