Simple understanding of jsp, servlet, and filter tomcat

Source: Internet
Author: User

I. jsp

1) What is jsp: jsp is a new object of tomcat and a subclass object of httpservlet. The code in <%> is only a snippet of its class method. We can compile it by writing a webpage.

2) What is jsp mainly used for? It is mainly used for page rendering and passes user actions received from the browser to servlet, you can also receive data from the servlet to render pages that we can understand.

3) What are the features of jsp? A single instance (a class-1 Object) is a request object with multiple threads (a service receives the next service without termination.

4) how to eliminate the java code in jsp: We can use jstl + el (which will be explained in a blog post later ).

Ii. servlet

1) What is servlet? It is also an object generated by tomcat new. It inherits the httpservlet object. What is different from jsp is, the methods and configurations in it are written by the programmer, so that tomcat can recognize it and call its methods when appropriate. It is complete.

2) What is servlet mainly used for? It is mainly used to receive data from jsp, encapsulate the data and call the corresponding business for data transmission and page Jump, you can also transmit data from the service to jsp.

3) What are the working characteristics of servlet? single-instance multithreading is also the request object.

In fact, jsp and servlet pages can be combined into one, but the jsp page looks messy and not easy to rewrite or debug! ! !

3. filter

1) What is a filter? It is a filter and an object generated by tomcat new. Like servlet, we need to fill in the class methods and configurations in it by ourselves, to facilitate tomcat identification. Its Class method is an interface.

2) What are filters mainly used for? 1. Chinese Garbled text 2. Sensitive Word Recognition 3. user login verification

3) features of filter: Multiple instances are automatically enabled and disabled when not in use, just like hot plugging ports.

4. tomcat

Tomcat is the container of jsp and servlet. It is responsible for jsp and servlet instantiation and method calling.


The listener will be analyzed later ....




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.