Issue with evaluating ${error} in Spring

你说的曾经没有我的故事 提交于 2019-12-11 04:33:10

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!