What are the similarities and differences between JSP and Servlet, and what is the connection between them?

<div class="iteye-blog-content-contain" style="font-size: 14px">

JSP is essentially a SERVLET

Servlet is completely composed of JAVA program code, which is good at process control and transaction processing. It is not intuitive to generate dynamic web pages through Servlet .

JSP consists of HTML code and JSP tags, which can easily write dynamic web pages .

Therefore, in practical applications, Servlet is used to control the business process, and JSP is used to generate dynamic web pages .

In the struts framework, JSP is located in the view layer of the MVC design pattern, and Servlet is located in the control layer .

JSP is an extension of Servlet technology and is essentially a simple way of Servlet .

The JSP is compiled into a " servlet -like ".

The main difference between servlets and JSPs is that the application logic of servlets is in Java files and is completely separated from the HTML in the presentation layer. And JSP is Java and HTML combined into a file with the extension .jsp .

JSP focuses on view, Servlet is mainly used for control logic.

 

JAVA code is embedded in JSP , while HTML code is embedded in Servlet .

</div>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326356466&siteId=291194637