The relationship and difference between JSP and servlet __js

Source: Internet
Author: User
Tags tomcat server

JSP is essentially a servlet,jsp compile is a "class servlet"

When a JSP server compiles a JSP page, it first writes a servlet to parse the JSP page content, using <%%> to turn it into a servlet, a Java class

To access the JSP by file name, where the configuration suffix named JSP is found according to the servlet configuration in the Tomcat server

Conf/web.xml files under the--tomcat directory

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>

<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

Then use the JSP engine to turn the JSP into a servlet

When accessing a JSP page, this request is actually a servelt

Difference: The application logic of the servlet is in the Java file and is completely detached from the HTML in the presentation layer. In the case of JSP, Java and HTML can be combined into a file with a. jsp extension. The JSP focuses on the view, Servelt primarily for logical control.

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.