简体   繁体   English

我从哪里获得servlet-api.jar?

[英]Where do I get servlet-api.jar from?

In order to write servlets code I need servlet-api.jar. 为了编写servlet代码,我需要servlet-api.jar。 Where do i get servlet-api.jar from ? 我从哪里获得servlet-api.jar?

Make sure that you're using the same Servlet API specification that your Web container supports. 确保您使用的是Web容器支持的相同Servlet API规范。 Refer to this chart if you're using Tomcat: http://tomcat.apache.org/whichversion.html 如果您使用的是Tomcat,请参阅此图表: http//tomcat.apache.org/whichversion.html

The Web container that you use will definitely have the API jars you require. 您使用的Web容器肯定会有您需要的API jar。

Tomcat 6 for example has it in apache-tomcat-6.0.26/lib/servlet-api.jar 例如,Tomcat 6在apache-tomcat-6.0.26/lib/servlet-api.jar

Grab it from here 这里抓住它

Just choose required version and click 'Binary'. 只需选择所需的版本,然后单击“二进制”。 eg direct link to version 2.5 例如,直接链接到2.5版

You may want to consider using Java EE, which includes the javax.servlet.* packages. 您可能需要考虑使用Java EE,其中包含javax.servlet.*包。 If you require a specific version of the servlet api, for instance to target a specific web application server, you will probably want the Java EE version which matches, see this version table . 如果您需要特定版本的servlet api,例如以特定Web应用程序服务器为目标,您可能需要匹配的Java EE版本,请参阅此版本表

You can find a recent servlet-api.jar in Tomcat 6 or 7 lib directory. 您可以在Tomcat 6或7 lib目录中找到最近的servlet-api.jar。 If you don't have Tomcat on your machine, download the binary distribution of version 6 or 7 from http://tomcat.apache.org/download-70.cgi 如果您的计算机上没有Tomcat,请从http://tomcat.apache.org/download-70.cgi下载版本6或7的二进制发行版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM