Dax Durax
Dax Durax

Reputation: 1657

JSTL, Tomcat6 -> Tomcat7 upgrade

I am in the process of upgrading tomcat6 to tomcat7. Currently the application deploys and works fine on tomcat6.

This is the config:

web.xml

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

in .jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

I have the jstl-1.2.jar, jstl-api-1.2.jar, jstl-1.2jar in my Tomcat/lib directory (same as Tomcat6).

I end up getting various exceptions related to this, such as:

org.apache.jasper.JasperException: /WEB-INF/tags/form/show.tagx (line: 25, column: 89) "${object.class.simpleName}.field.${property}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${object.class.simpleName}.field.${property}]

in my pom.xml I am pulling in

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

Should Tomcat7 not support 2.5? I have tried using 3.0 but to no avail. Any insight appreciated. I have tried some of the solutions provided here:

How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved

Tomcat 7 and JSTL

but with no success.

Upvotes: 0

Views: 534

Answers (1)

Federico Sierra
Federico Sierra

Reputation: 5208

The identifier [class] is not a valid Java identifier as required by EL specification. This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.

-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true

Or you can use the following expression equivalent one instead:

${object.['class'].simpleName}.field.${property}

Upvotes: 1

Related Questions