Does the "web-app_*.dtd" reference web.xml determine the Servlet and JSP version used in the web application ?
Somehow I have been under that impression, but it seems like I am wrong. I have an application where the web.xml specifies
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
I was thinking that it should be using Servlet version 2.3. However, when I put the following code in my JSP, I get a totally different version.
<div>
Server info: <%= application.getServerInfo() %><br>
Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
</div>
Output:
Server info: Apache Tomcat/7.0.21
Servlet version: 3.0
JSP version: 2.1
I will appreciate help with a few related questions:.
- Does the dtd version have any bearing on the Servlet and JSP version used in the application ?
- Is my application using Servlet version 3.0 because that is the default version being used by Apache Tomcat 7 ?
- Is there any way to make Tomcat 7, use an older Servlet JSP version ?
- One of the comments (by Bauke Scholtz) on this page, seems to suggest that every Servlet version is tied to a JSP version. Is this always true ?