How to know which servlet and JSP version am I using?

前端 未结 3 1082
青春惊慌失措
青春惊慌失措 2021-01-30 13:45

Can you tell me how to know which servlet and JSP version am I using ? I use NetBeans IDE 7.1.2 for creating Servlets and JSP.

相关标签:
3条回答
  • 2021-01-30 14:01

    You can get the details programatically using ServletContext #getMajorVersion() and #getMinorVersion().

    For knowing the JSP version corresponding to the Servlet, you can get details from this Tomcat page

    Below is the summary,

    Servlet 2.5 uses JSP 2.1 
    Servlet 2.4 uses JSP 2.0 
    Servlet 2.3 uses JSP 1.2 
    Servlet 2.2 uses JSP 1.1 
    Servlet 2.1 uses JSP 1.0
    
    0 讨论(0)
  • 2021-01-30 14:23

    You can easily check the JSP,SERVER and SERVLET version. Add the following code in your jsp page after that run using any IDE Tools.

    Server Version: <%= application.getServerInfo() %><br>
    Servlet Version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>
    JSP Version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %> <br>
    
    0 讨论(0)
  • 2021-01-30 14:24

    The version is declared in the web.xml file using the attribute version.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app 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/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
    ...
    </web-app>
    

    Read more

    0 讨论(0)
提交回复
热议问题