tomcat common questions and answers interview questions Top10

Tomcat server is a free open source Web application server, Tomcat is a core project of the Apache Software Foundation (Apache Software Foundation) in Jakarta project, which is an early name for catalina, and later by Apache, Sun and other companies and individuals to develop together, and changed its name to Tomcat.

Tomcat is a small, lightweight application server, it is widely used in small and medium systems and concurrent user access is not a lot of occasions, is to develop and debug JSP program of choice, because Tomcat advanced technology, stable performance, become more popular Web application server. Interview, tomcat also often involved.

The following extract some common issues to discuss, welcome to ask more questions or answers.

1. What is tomcat?

  

   Simply put, tomcat is to achieve servlet, jsp, el, webSocket and other technologies.

2.tomcat 6,7,8,9 What is the difference

 

3. tomcat What are the components?

  

 4. tomcat What Connector?

  Connector Tomcat Web server supports two protocols: AJP and HTTP, which both define a binary format for data transfer between the Web server and the Tomcat, and provide corresponding control commands.

    AJP (Apache JServ Protocol) protocols: AJP protocol version currently being used is supported by JK and JK2 connector AJP13, which is based on the binary formats to transfer data, while the previous version AJP10 and AJP11 between the Web server and Tomcat transmitting data in text format is used.

    HTTP protocol: As the name implies, it is using the HTTP or HTTPS protocol to establish communication between the Web server and Tomcat, this time, Tomcat is a fully functional HTTP server, it needs to listen on a port to receive from suppliers request before the server.

 What is the role of Valve 5. tomcat is?

  Valve类似于过滤器,它可以工作于Engine和Host/Context之间、Host和Context之间以及Context和Web应用程序的某资源之间。一个容器内可以建立多个Valve,而且Valve定义的次序也决定了它们生效的次序。

  

6.Webserver 和 Application Server的区别是什么?

 最大区别,WebServer 一般仅仅指Web(如servlet,jsp)的应用服务器,ApplicationServer不仅可以是Web,还可以是Ejb等其它的应用服务器。

web server可以是application server的一部分,也可以是单独存在。

 

7.如何修改tomcat的默认端口

$ TOMCAT_HOME /conf/server.xml下

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

8. 如何修改默认的home页面?

  $TOMCAT_HOME/conf/web.xml或者$TOMCAT_HOME/webapps/WEB-INF /web.xml 的welcome-file-list

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

9. servlet的生命周期?

Servlet 生命周期可被定义为从创建直到毁灭的整个过程。以下是 Servlet 遵循的过程:

  • Servlet 通过调用 init () 方法进行初始化。
  • Servlet 调用 service() 方法来处理客户端的请求。
  • Servlet 通过调用 destroy() 方法终止(结束)。
  • 最后,Servlet 是由 JVM 的垃圾回收器进行垃圾回收的。

10. jsp的生命周期?

 

 

参考资料:

【1】http://www.ttlsa.com/tomcat/tomcat-install-and-configure/

【2】https://www.runoob.com/servlet/servlet-life-cycle.html

【3】https://en.wikipedia.org/wiki/JavaServer_Pages

Guess you like

Origin www.cnblogs.com/davidwang456/p/11271326.html