java 我如何知道我的 Tomcat 是否支持 Servlet 3.0?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14359230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 16:00:13  来源:igfitidea点击:

How do I know if my Tomcat supports Servlet 3.0 or not?

javatomcatservlets

提问by Adam Lee

I am using Tomcat 6.33 and I am wondering how can I check if it supports Servlet 3.0 or El 2.2 or not?

我正在使用 Tomcat 6.33,我想知道如何检查它是否支持 Servlet 3.0 或 El 2.2?

回答by Stephen C

You can check by reading the Tomcat documentation - see the Apache Tomcat Versionspage ... which lists the versions of the JSP and Servlet specs supported by each major version of Tomcat.

您可以通过阅读 Tomcat 文档进行检查 - 请参阅Apache Tomcat 版本页面...其中列出了 Tomcat 的每个主要版本支持的 JSP 和 Servlet 规范的版本。

(Answer from the list: Tomcat 6.x supports Servlet 2.5 and JSP/EL 2.1)

(答案来自列表:Tomcat 6.x 支持 Servlet 2.5 和 JSP/EL 2.1)



If you want to find out the Servlet spec version at runtime, the ServletContextAPI has methods called getMajorVersion()and getMinorVersion()that should tell you.

如果您想在运行时找出 Servlet 规范版本,ServletContextAPI 会调用方法getMajorVersion()getMinorVersion()这应该会告诉您。

I also foundthis recipe for displaying various version numbers using a JSP:

我还发现了这个使用 JSP 显示各种版本号的秘诀:

Server info: <%= application.getServerInfo() %><br>
Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %><br>
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
Java version: <%= System.getProperty("java.version") %><br>

回答by igo

From http://tomcat.apache.org/whichversion.html: Tomcat 6 supports Servlet 2.5

来自http://tomcat.apache.org/whichversion.html:Tomcat 6 支持 Servlet 2.5

回答by Abhijeet

Servlet 3.0 API is supported on Apache Tomcat 7.0.x onwords, Apache Tomcat 7.0.65being the actual release version.

Apache Tomcat 7.0.x onwords 支持 Servlet 3.0 API,Apache Tomcat 7.0.65是实际发布版本。