简述: 在JavaWeb中web.xml踩得雷。

本文初发于 “曾晨de小站” zengchen233.cn,同步转载于此。

<?xml version="1.0" encoding="UTF-8"?>
<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"
id="WebApp_ID" version="3.1">

</web-app>

这是新版本的web.xml初始文件,原因是我在写一个request重定向的时候无法解析

${pageContext.request.contextPath}/login

于是上网搜索了好久终于解决了这个问题,故此写个博客来记录一下,防止以后踩坑!