Servlet 2.4 in web.xml
:
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
Servlet 3.0 in web.xml
:
<web-app version="3.0"
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_3_0.xsd">
That's the only difference. The rest is your IDE configuration. In order to use Servlet 3.0 you must have 3.0 JARs on the CLASSPATH so that new annotations and other classes are available. But do not include servlet JAR in your WAR, the implementation should come from the servlet container.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…