问题
I have defined an expression as ${error} in my jsp page , and when i am printing the value of the same using <c:out value='${error}' />
, the output is ${error}
. Whereas the expression is not being evaluated.
I have included the jstl-1.2-api and jstl1.2-impl jar files in my lib directory , and also included the taglib <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
in my JSP.
Can anybody please help.
回答1:
You need to ensure that your web.xml
is declared conform at least Servlet 2.5 spec and that your container also actually supports this. For example, Tomcat 6.x or newer.
<?xml version="1.0" encoding="UTF-8"?>
<web-app
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"
version="2.5">
<!-- Config here. -->
</web-app>
You also need to ensure that the /WEB-INF/lib
of the WAR is not cluttered with servletcontainer-specific libraries of an older version, such as jsp-api.jar
, el-api.jar
, etcetera.
来源:https://stackoverflow.com/questions/8231889/issue-with-evaluating-error-in-spring