使用${pageContext.request.contextPath} 出现错误(转载)
IDEA开发web项目 使用${pageContext.request.contextPath} 出现问题
今天在写web项目时,在前端页面中使用${pageContext.request.contextPath}获取路径时出现%7BpageContext.request.contextPath%7D
使用${pageContext.request.contextPath} 如下:

错误如下:

最后发现是web.xml的问题 我的xml是这样的:

改成这样就好了:

最后附上代码:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Archetype Created Web Application</display-name>
</web-app>


浙公网安备 33010602011771号