Can i use api 3.0 servlet and berth 8?

I want to use 3.0 servlet-api with Jetty 8. Currently 2.4 servlet-api is defined in my web.xml. And in the webdefault.xml 2.5 file servlet-api is defined. Someone else asked this so they would do something wrong very well. What version of servlet api am i using? 2.4 or 2.5? I already have 3.0 in my classpath. What do I need to change in web.xml and / or webdefault.xml to make it work?

Thanks in advance.

+4
source share
1 answer

Usually you do not provide the Servlet API yourself. This is typically provided by the target servlet container itself. Examples of Servlet 3.0 compatible containers: Tomcat 7.x , Glassfish 3.x , JBoss AS 6.x / 7.x and, yes, Jetty 8.x.

You just need to declare the root element of the <web-app> web.xml to match the highest version supported by the target container.

 <?xml version="1.0" encoding="UTF-8"?> <web-app 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" version="3.0"> </web-app> 

See also:

+10
source

All Articles