1. 程式人生 > >關於servlet3中,使用註解配置之後,訪問無效的解決方法

關於servlet3中,使用註解配置之後,訪問無效的解決方法

web專案中的web.xml檔案的根元素如果是從其他地方拷貝的,如下所示

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
metadata-complete="true"
  version="4.0">

需要從根元素中刪除 metadata-complete="true",並且不要重複配置servlet的訪問名。