Java interview questions-containers, JSP containers, and JSP Engines

Source: Internet
Author: User

Problem:

What is a container?

What is a JSP Container?

What is the role of JSP containers?

What is a JSP engine?

 

Analysis:

These problems are the same. They all describe how JSP or servlet objects are managed or run.

 

Answer:

First, we should understand that JSP or servlet operations and common clientsProgramClient programs are called directly. jsp or servlet operations require servers, which are usually called application servers. servers are responsible for creating JSP or servlet objects, then, call the corresponding methods of the JSP object or servlet object.

 

Who created the JSP or servlet object and called the method? It is done by a container, or a JSP Container.

Containers are used to hold other components. These components include JSP or servlet to create component objects, call methods, and destroy objects.

 

How does the container know which JSP or servlet object to create? For JSP, it is determined by the file name, and for servlet, it is determined by the configuration in Web. xml.

 

How does the container know which method to call JSP or Servlet? For JSP, the JSP page is converted to a Java class, and the content in the page is converted to the content of a method in the Java class, and the name of this method is fixed, the container will call this method. For Servlets, you need to write the doget or dopost methods based on the request type. The container will call the doget or dopost methods respectively based on the Request Method "get" or "Post.

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.