我的應用程序當前使用servlet-api.jar版本2.4進行編譯。
該jar與代碼一起打包並部署在tomcat服務器上。
web.xml中也有相同的版本即使我實際使用Servlet-api jar版本3.0,我是否可以保留web.xml 2.4版本
<web-app id="WebApp_ID" 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">
但現在,我們已經部署了代碼的Tomcat是升級到servlet的api.jar文件版本3.0。
而且我們需要停止將jar與我們的代碼捆綁在一起,而是使用tomcat提供的jar。
我想知道:
1)我能保持完整的web.xml(即沒有提及3.0),只有改變的pom.xml編譯使用3.0的代碼?會不會對應用程序運行產生影響?
[參考文獻1] java, tomcat: what is the meaning of the id attribute in the tag web-app in web.xml?
[參考文獻2] http://docs.oracle.com/cd/E13222_01/wls/docs100/webapp/web_xml.html
[參考文獻3] Java web app - What determines my Servlet API version? Does it get specified in web.xml?
你是對的。我們不打算將jar與代碼捆綁在一起。它將由容器提供。 是的,它是Tomcat 7.0 –