精华内容
下载资源
问答
  • tomcatServlet对象池 Servlet在不实现SingleThreadModel的情况下运行时是以单个实例模式,如下图,这种情况下,Wrapper容器只会通过反射实例化一个Servlet对象,...为了支持一个Servlet对象对应一个线程,Servlet规范
  • IDEA2020 tomcat10 servlet 较新版本 踩坑记录

    千次阅读 多人点赞 2021-04-14 23:21:41
    8: 在src里面新建一个java class,尝试写一个servlet: 这里也是与其他版本不同的地方,老版本都是import javax.servlet.xxxxx,这里是import jakarta.servlet.xxxxx,具体应该import的包,可以展开servlet-api....

    因为学习的时候用的版本比较新,而网上的教程又全是老版本,所以出现了很多问题,总结以下,帮同样初学的师傅们踩坑了。
    话不多说:

    1:
    file->new->project新建一个普通java项目:
    工程名可以随意命名

    2:
    工程名上右键->Add Framework Support:

    在Web Application上打勾,点击OK

    3:
    展开工程名->web->WEB-INF,在WEB-INF下新建两个文件夹,分别是classes、lib:

    4:
    按下ctrl+alt+shift+S,调出Project Structure,
    选到Modules->Paths,单选框选到use module xxxxx,将两个路径改为刚才创建的classes。
    然后选到Dependencies,点击下面的+号,选择jars or dirxxxxxxxx,选择刚创建的lib目录,让选择目录用处的话,选择jar direxxxxxxx,打上勾,点击apply,OK

    5:
    将tomcat/lib目录下的servlet-api.jar复制到我们创建的lib目录里。

    6:
    点击右上角小锤子旁边的Add Configuration,点击加号,选择tomcat server->local。这里注意不要选成tomEE的,两者图标一样,但是不是一个东西。其他配置不变,点击aplly上面的fix,application context可以随意命名,建议一个/就可以。然后aplly,OK。

    7:
    改一改index.jsp中带的title和end,运行一下,如果类似以下,那基本就OK了。

    8:
    在src里面新建一个java class,尝试写一个servlet:
    这里也是与其他版本不同的地方,老版本都是import javax.servlet.xxxxx,这里是import jakarta.servlet.xxxxx,具体应该import的包,可以展开servlet-api.jar看到。
    在这里插入图片描述

    import jakarta.servlet.ServletException;
    import jakarta.servlet.annotation.WebServlet;
    import jakarta.servlet.http.HttpServlet;
    import jakarta.servlet.http.HttpServletRequest;
    import jakarta.servlet.http.HttpServletResponse;
    import java.io.IOException;
    import java.io.PrintWriter;
    
    @WebServlet(name = "login")
    public class Login extends HttpServlet {
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<!DOCTYPE HTML>");
            out.println("<HTML>");
            out.println("  <HEAD><TITLE>login</TITLE></HEAD>");
            out.println("  <BODY>");
            out.print("    this is login page");
            out.print(this.getClass());
            out.println("  </BODY>");
            out.println("</HTML>");
            out.flush();
            out.close();
        }
    
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<!DOCTYPE HTML>");
            out.println("<HTML>");
            out.println("  <HEAD><TITLE>login</TITLE></HEAD>");
            out.println("  <BODY>");
            out.print("    this is login page");
            out.print(this.getClass());
            out.println("  </BODY>");
            out.println("</HTML>");
            out.flush();
            out.close();
        }
    }
    
    

    然后修改web.xml文件,如下:
    servlet-name可以任意命名,只要上下两个一致就可以,servlet-class应该与类名相同,url-pattern是与java class中的@WebServlet(name=“xxxx”)的xxxx相同,这里的xxxx就是路径。
    此时编译并运行,在地址栏输入我们写的url,就可以访问到动态资源了:

    全篇结束,只是记录踩坑,希望能对大家有帮助。

    展开全文
  • tomcatservlet的关系

    2020-12-05 11:46:52
    Servlet是一种运行在支持Java语言的服务器上的组件. Servlet最常见的用途是扩展Java Web服务器功能,提供非常安全的,可移植的,易于使用的CGI替代品. 从http协议中的请求和响应可以得知,浏览器发出的请求是一个...

    tomcat和servlet的关系

    Tomcat 是Web应用服务器,是一个Servlet/JSP容器. Tomcat 作为Servlet容器,负责处理客户请求,把请求传送给Servlet,并将Servlet的响应传送回给客户.而Servlet是一种运行在支持Java语言的服务器上的组件. Servlet最常见的用途是扩展Java Web服务器功能,提供非常安全的,可移植的,易于使用的CGI替代品.

    从http协议中的请求和响应可以得知,浏览器发出的请求是一个请求文本,而浏览器接收到的也应该是一个响应文本。但是在上面这个图中,并不知道是如何转变的,只知道浏览器发送过来的请求也就是request,我们响应回去的就用response。忽略了其中的细节,现在就来探究一下。

      ①:Tomcat将http请求文本接收并解析,然后封装成HttpServletRequest类型的request对象,所有的HTTP头数据读可以通过request对象调用对应的方法查询到。

      ②:Tomcat同时会要响应的信息封装为HttpServletResponse类型的response对象,通过设置response属性就可以控制要输出到浏览器的内容,然后将response交给tomcat,tomcat就会将其变成响应文本的格式发送给浏览器

      Java Servlet API 是Servlet容器(tomcat)和servlet之间的接口,它定义了serlvet的各种方法,还定义了Servlet容器传送给Servlet的对象类,其中最重要的就是ServletRequest和ServletResponse。所以说我们在编写servlet时,需要实现Servlet接口,按照其规范进行操作。

    展开全文
  • tomcat对应servlet版本

    千次阅读 2018-10-03 16:08:54
  • TomcatServlet、JDK三者的支持关系

    千次阅读 2016-12-15 12:09:32
    Apache Tomcat® is an open source software implementation of the Java Servlet and JavaServer Pages technologies. Different versions of Apache Tomcat are available for different versions of the ...

    Apache Tomcat® is an open source software implementation of the Java Servlet and JavaServer Pages technologies. Different versions of Apache Tomcat are available for different versions of the Servlet and JSP specifications. The mapping between the specifications and the respective Apache Tomcat versions is:

    Servlet Spec JSP Spec EL Spec WebSocket Spec JASPIC Spec Apache Tomcat version Actual release revision Supported Java Versions
    4.0TBD (2.4?)TBD (3.1?)TBD (1.2?)1.19.0.x9.0.0.M15 (alpha)8 and later
    3.12.33.01.11.18.5.x8.5.97 and later
    3.12.33.01.1N/A8.0.x (superseded)8.0.39 (superseded)7 and later
    3.02.22.21.1N/A7.0.x7.0.736 and later
    (7 and later for WebSocket)
    2.52.12.1N/AN/A6.0.x6.0.485 and later
    2.42.0N/AN/AN/A5.5.x (archived)5.5.36 (archived)1.4 and later
    2.31.2N/AN/AN/A4.1.x (archived)4.1.40 (archived)1.3 and later
    2.21.1N/AN/AN/A3.3.x (archived)3.3.2 (archived)1.1 and later

    Each version of Tomcat is supported for any stable Java release that meets the requirements of the final column in the table above.

    Tomcat should also work on any Java early access build that meets the requirements of the final column in the table above. For example, users were successfully running Tomcat 8 on Java 8 many months before the first stable Java 8 release. However, users of early access builds should be aware of the following:

    • It is not unusual for the initial early access builds to contain bugs that can cause problems for web applications running on Tomcat.
    • If the new Java version introduces new language features then the default JSP compiler may not support them immediately. Switching the JSP compiler to javac may enable these new language features to be used in JSPs.
    • If you do discover an problem using a Java early access build, please ask for help. The Tomcat user's mailing list is probably the best place to start.

    The releases are described in more detail below to help you determine which one is right for you. More details about each release can be found in the associated release notes.

    Please note that although we offer downloads and documentation of older releases, such as Apache Tomcat 6.x, we strongly encourage users to use the latest stable version of Apache Tomcat whenever possible. We recognize that upgrading across major versions may not be a trivial task, and some support is still offered on the mailing list for users of old versions. However, because of the community-driven support approach, the older your version, fewer people will be interested or able to support you.

    Alpha / Beta / Stable

    When voting for a release, reviewers specify the stability level that they consider the release has reached. Initial releases of a new major version typically process from Alpha, through Beta to Stable over a period of several months. However, the Stable level is only available once the Java specifications the release implements have been finalised. This means a release that in all other respects is considered stable, may still be labelled as Beta if the specifications are not final.

    The download pages will always show the latest stable release and any newer Alpha or Beta release if one exists. Alpha and beta releases are always clearly marked on the download pages.

    Stability is a subjective judgement and you should always read carefully the release notes for any version you intend to make use of. If you are an early adopter of a release, we would love to hear your opinion about its stability as part of the vote: it takes place on the development mailing list.

    Alpha releases may contain large amounts of untested/missing functionality required by the specification and/or significant bugs and are not expected to run stably for any length of time.

    Beta releases may contain some untested functionality and/or a number of relatively minor bugs. Beta releases are not expected to run stably.

    Stable releases may contain a small number of relatively minor bugs. Stable releases are intended for production use and are expected to run stably for extended periods of time.

    Apache Tomcat 9.x

    Apache Tomcat 9.x is the current focus of development, it builds on Tomcat 8.0.x and implements the current draft of the Servlet 4.0 specification and will also implement the JSP 2.4?EL 3.1? and Web Socket 1.2? specifications once work starts on updating those specifications for Java EE 8. In addition to this, it includes the following significant improvements:

    • Adds support for HTTP/2 (requires the APR/native library)
    • Adds support for TLS virtual hosting
    • Adds support for using OpenSSL for TLS support with the JSSE connectors (NIO and NIO2)

    Apache Tomcat 8.x

    Apache Tomcat 8.x builds on Tomcat 7.0.x and implements the Servlet 3.1JSP 2.3EL 3.0 and Web Socket 1.1 specifications. In addition to that, it includes the following significant improvements:

    • A single, common resources implementation to replace the multiple resource extension features provided in earlier versions.

    Apache Tomcat 7.x

    Apache Tomcat 7.x builds upon the improvements made in Tomcat 6.0.x and implements the Servlet 3.0JSP 2.2EL 2.2 and Web Socket 1.1 specifications. In addition to that, it includes the following improvements:

    • Web application memory leak detection and prevention
    • Improved security for the Manager and Host Manager applications
    • Generic CSRF protection
    • Support for including external content directly in a web application
    • Refactoring (connectors, lifecycle) and lots of internal code clean-up

    Apache Tomcat 6.x

    Apache Tomcat 6.x builds upon the improvements made in Tomcat 5.5.x and implements the Servlet 2.5 and JSP 2.1 specifications. In addition to that, it includes the following improvements:

    • Memory usage optimizations
    • Advanced IO capabilities
    • Refactored clustering

    Users of Tomcat 6 should be aware that the Tomcat team have announced the end of life date for Tomcat 6.x. Users of Tomcat 6.x should plan to upgrade before Tomcat 6.x reaches end of life.

    Apache Tomcat 5.x

    Apache Tomcat 5.x is available for download from the archives.

    Apache Tomcat 5.5.x supports the same Servlet and JSP Specification versions as Apache Tomcat 5.0.x. There are significant changes in many areas under the hood, resulting in improved performance, stability, and total cost of ownership. Please refer to the Apache Tomcat 5.5 Changelog for details.

    Apache Tomcat 5.0.x improves on Apache Tomcat 4.1 in many ways, including:

    • Performance optimizations and reduced garbage collection
    • Refactored application deployer, with an optional standalone deployer allowing validation and compilation of a web application before putting it in production
    • Complete server monitoring using JMX and the manager web application
    • Scalability and reliability enhancements
    • Improved Taglibs handling, including advanced pooling and tag plugins
    • Improved platform integration, with native Windows and Unix wrappers
    • Embedding using JMX
    • Enhanced Security Manager support
    • Integrated session clustering
    • Expanded documentation

    Apache Tomcat 4.x

    Apache Tomcat 4.x is available for download from the archives.

    Apache Tomcat 4.x implements a new servlet container (called Catalina) that is based on completely new architecture. The 4.x releases implement the Servlet 2.3 and JSP 1.2 specifications.

    Apache Tomcat 4.1.x is a refactoring of Apache Tomcat 4.0.x, and contains significant enhancements, including:

    • JMX based administration features
    • JSP and Struts based administration web application
    • New Coyote connector (HTTP/1.1, AJP 1.3 and JNI support)
    • Rewritten Jasper JSP page compiler
    • Performance and memory efficiency improvements
    • Enhanced manager application support for integration with development tools
    • Custom Ant tasks to interact with the manager application directly from build.xml scripts

    Apache Tomcat 4.0.x. Apache Tomcat 4.0.6 is the old production quality release. The 4.0 servlet container (Catalina) has been developed from the ground up for flexibility and performance. Version 4.0 implements the final released versions of the Servlet 2.3 and JSP 1.2 specifications. As required by the specifications, Apache Tomcat 4.0 also supports web applications built for the Servlet 2.2 and JSP 1.1 specifications with no changes.

    Apache Tomcat 3.x

    Apache Tomcat 3.x is available for download from the archives.

    • Version 3.3 is the current production quality release for the Servlet 2.2 and JSP 1.1 specifications. Apache Tomcat 3.3 is the latest continuation of the Apache Tomcat 3.x architecture; it is more advanced then 3.2.4, which is the 'old' production quality release.
    • Version 3.2.4 is the 'old' production quality release and is now in maintenance only mode.
    • Version 3.1.1 is a legacy release.

    All Apache Tomcat 3.x releases trace their heritage back to the original Servlet and JSP implementations that Sun donated to the Apache Software Foundation. The 3.x versions all implement the Servlet 2.2 and JSP 1.1 specifications.

    Apache Tomcat 3.3.x. Version 3.3.2 is the current production quality release. It continues the refactoring that was begun in version 3.2 and carries it to its logical conclusion. Version 3.3 provides a much more modular design and allows the servlet container to be customized by adding and removing modules that control the processing of servlet requests. This version also contains many performance improvements.

    Apache Tomcat 3.2.x. Version 3.2 added few new features since 3.1; the major effort was a refactoring of the internals to improve performance and stability. The 3.2.1 release, like 3.1.1, was a security patch. Version 3.2.2 fixed a large number of bugs and all known specification compliance issues. Version 3.2.3 was a security update that closes a serious security hole. Version 3.2.4 is a minor bug fix release. All users of Apache Tomcat versions prior to 3.2.3 should upgrade as soon as possible. With the exception of fixes for critical security related bugs, development on the Apache Tomcat 3.2.x branch has stopped.

    Apache Tomcat 3.1.x. The 3.1 release contained several improvements over Apache Tomcat 3.0, including servlet reloading, WAR file support and added connectors for the IIS and Netscape web servers. The latest maintenance release, 3.1.1, contained fixes for security problems. There is no active development ongoing for Apache Tomcat 3.1.x. Users of Apache Tomcat 3.1 should update to 3.1.1 to close the security holes and they are strongly encouraged to migrate to the current production release, Apache Tomcat 3.3.

    Apache Tomcat 3.0.x. Initial Apache Tomcat release.

    展开全文
  • Tomcat新特性:支持Servlet3.0注解定义,无需配置web.xml 前言 tomcat从7.0版本开始就支持Servlet3.0,在Eclipse中不再需要web.xml配置servlet,而通过注解的方式找寻servlet。 电脑环境: Windows10教育版 ...
  • import javax.servlet.*; import java.io.IOException; public class ServletDemo implements Servlet { @Override public void init(ServletConfig servletConfig) throws ServletException { } @Override ...
  • Tomcat版本对于Servlet版本的支持

    千次阅读 2018-03-09 00:38:52
    http://blog.csdn.net/i_love_t/article/details/54288326由于在写一个SSM小...后来在上面的文章中查找得到:Apache Tomcat 7.x的Apache Tomcat 7.x的建立在Tomcat中6.0.x的改进和实现的Servlet 3.0,JSP 2.2,EL ...
  • TomcatServlet对应关系

    千次阅读 2018-09-15 14:05:24
    TomcatServlet 技术对应关系 tomcat 版本 servlet版本 JSP版本 tomcat 6 Servlet2.5 JSP2.1 tomcat 7 Servlet3.0 JSP2.2 tomcat 8 Servlet3.1 JSP2.3 tomcat 9 ...
  • 对于这些机制的支持都必须由Tomcat内部去支持,具体则是由Wrapper容器提供支持。 在tomcat中消息流的流转机制是通过四个不同级别的容器管道机制进行流转的,对于每个请求都是一层一层处理的。如下图,当客户端请求...
  • TomcatServlet之间的关系

    万次阅读 多人点赞 2018-01-17 14:22:28
    Servlet(小服务程序)是一个与协议无关的、跨平台的Web组件,它基于Java技术开  发,由Servlet容器所管理。和运行在客户端浏览器中的Applet(小应用程序)相似,Servlet  运行在服务器端,可以动态地扩展...
  • TomcatServlet与CGI区别和内容

    千次阅读 2018-08-12 10:24:47
    为了支持Servlet,通常要单独开发程序,这种程序一般称为服务器小程序容器(Servlet Container),有时也叫做服务器小程序引擎(Servlet Engine)。它是Web服务器或应用程序服务器的一部分,用于在发送的请求和响应...
  • tomcat是8.0 jdk是1.8 请问支持servlet/jsp 2.5/2.1 吗?这样会有什么后果 刚开始学习javaweb 电脑以前装过tomcat 8.0 可是教程上老师是用tomcat6.0 servlet/jsp 2.5/2.1 ,如果不重新装tomcat6.0会不会出问题
  • ServletTomcat的关系

    千次阅读 2019-08-22 16:55:03
    ServletTomcat的关系概述 在web项目时,多数需要http协议,也就是基于请求和响应,比如你在百度输入一行内容搜索, 那么百度服务器如何处理这个请求呢,他需要创建servlet来处理,servlet其实就是java程序,只是...
  • Tomcat是一个Servlet容器”,这句话对于JAVA程序员们应该都是耳熟能详。 但是就这么单纯的这么一句话被阿里面试官嘴里问出来之后,你觉得还那么简单吗? 好,单纯的思考一下这句话,我们可以抽象出来这么一段代码...
  • servlet工作原理之tomcat

    千次阅读 2019-06-10 10:34:13
    本文要点: 1、servlet容器即包含wrapper的context容器 2、servelt的config、request、response、session、context等均使用了门面模式 3、listener,事件监听器在tomcat启动,容器以及servlet生命周期中的应用。
  • servlet规范 JSP规范 tomcat版本 JDK版本 4 2.3 9.0.X JDK8 3.1 2.3 8.5.X JDK7 3.0 2.2 7.0.X JDK6 2.5 2.1 6.0.X JDK5 2.4 2.0 5.5.X JDK1.4 2.3 1.2 4.1.X JDK1.3 2.2 1.1 3.3.X JDK1.1 ...
  • JDK1.8 JRE1.8 Tomcat 8.0 @WebServlet简介 @WebServlet标注允许servlet映射声明在servlet代码,作用同通过映射部署描述符(web.xml)文件的servlet. @WebServlet解释 假如我起一个名为TesrServlet01的Servlet类,...
  • 深入剖析tomcatservlet容器

    千次阅读 2015-09-01 08:54:46
    其实我们开发中经常用tomcat应用服务器,tomcat就一个servlet容器,能够运行基于serlvlet的应用程序并响应相应的http请求,开发时间长了,还是想想具体知道它是怎么运行的,尤其是servlet容器的机理,所以有幸拜读了...
  • idea 中 tomcat 部署 servlet启动

    千次阅读 2020-11-02 12:57:09
    idea 中 tomcat 部署 servlet启动 创建新的 项目 Create New Project 点击空的项目 , Empty Project 点击下一步 设置项目的名字 Project name 点击完成 配置 Run / Configration 点击加号 然后在点Tomcat 服务器...
  • 关于TomcatServlet容器的小结

    千次阅读 2018-08-30 17:37:45
    Tomcat是一个servlet容器,实现了对Servlet和JSP的支持,除此之外,tomcat还可以作为 一个web应用服务器。独立的Servlet容器是Tomcat的默认模式。管理和运行Servlet/JSP的 容器也称为WEB容器。 Tomcat服务器接受客户...
  • Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [spring_... See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering tomcat与ser
  • Tomcat在$ CATALINA_BASE/conf/web.xml中默认定义了两个Servlet:DefaultServlet和JspServlet,而且由于$ CATALINA_BASE/conf/web.xml为Web应用的默认部署描述文件,因此这两个Servlet会默认存在所有Web应用容器中。...
  • servlettomcat的关系

    万次阅读 多人点赞 2018-03-21 16:51:29
    Servlet 工作原理解析:https://www.ibm.com/developerworks/cn/java/j-lo-servlet/ JSP九大内置对象的作用和用法总结?http://blog.csdn.net/sona_shi555/article/details/7797068 Servlet简介与Servlet和...
  • Tomcat(这里以tomcat代表web服务器)和Servlet对比: Tomcat可以理解成用于http平台的服务器,能接受http的请求并分析。 Servlet是java内部的一种规范,准确的说,他可以对参数进行分析,创建对象然后返回数据。 ...
  • 生产就绪的Apache Tomcat Java Servlet应用程序服务器 支持的标签 8.5.X-BUILD , 8.5.X , 8.5 , 8 , latest 7.0.X-BUILD , 7.0.X , 7.0 , 7 其中X是补丁程序版本号,而BUILD是内部版本号(查看项目“页面以...
  • Servlet容器和Tomcat容器区别

    千次阅读 多人点赞 2019-07-01 15:02:34
    一提到容器,很多新手就会忘文生畏,认为这是很难很高深的东西。...Java Servlet(Java服务器小程序)是一个基于Java技术的Web组件,运行在服务器端,它由Servlet容器所管理,用于生成动态的内容。 Servl...
  • Servlet , JSP 规范版本和tomcat 版本之前的关系图 Servlet Spec JSP Spec JSTL(jsp标准标签库) EL Spec WebSocket Spec jdk Apache Tomcat Version JavaEE Version 4.0 2.3 1.2 3.0 1.1 JDK...
  • JSP的ServletTomcat

    2019-06-04 21:53:34
    TomcatServlet的容器,Servlet运行在Tomcat容器当中(如docker镜像运行在docker容器当中)Servlet容器有很多(tomcat,Jboss,weblogic)等;Tomcat根据JSP页面生成对应Servlet的Java文件及class文件。 JSP是动态网页...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 126,575
精华内容 50,630
关键字:

tomcat支持servlet吗