Servlet 4.0 네임 스페이스를 사용하려고했습니다. 응용 프로그램 잘 일을하지만, IDEA 오류 감지 : "요소 웹 응용 프로그램이" "선언해야요소 web-app를 선언해야합니다 (Servlet 4.0)
<?xml version="1.0" encoding="UTF-8"?>
<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"
version="4.0">
...
...
</web-app>
Snapshot 는 (내가 직접 이미지를 게시 할 수 없습니다.)
. 나는, 3.1 버전을 변경 그것은 잘 작동 :
<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_3_1.xsd"
version="3.1">
을 Java EE: XML Schemas for Java EE Deployment Descriptors# Using Java EE Schemas에 따르면
All Java EE 7 and newer Deployment Descriptor Schemas share the namespace http://xmlns.jcp.org/xml/ns/javaee/ . Each schema document contains a version attribute that contains the version of the specification. For example, the XML Schema document for the Servlet specification contains the version attribute value "3.1", pertaining to the specific version of the specification as well as the schema document itself.
version="4.0"
은 지원되지 않습니까? IntelliJ IDEA 2017.2.5 + javax.servlet-api 4.0 + Apache Tomcat v9.0.1을 사용합니다.
업데이트 : 나는 (apache-tomcat-9.0.1/webapps/examples/WEB-INF/web.xml
에서) 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"
version="4.0"
metadata-complete="true">
4.0 서블릿 사양을 처리하는 응용 프로그램 서버를 대상으로합니까? 현재 Glassfish 5.0은 2017 년 9 월이나 Tomcat 9에서만 출시됩니다. – stdunbar
@stdunbar 중계 해 주셔서 감사합니다. 나는 Tomcat v9.0.1을 사용한다. – shui