[JavaEE] The first JSP program - understand the JSP execution process

First learn the basic structure of JSP as follows:

<%@ page language="java" import="java.util.*"
pageEncoding="ISO-8859-1"%>
<html>
<body>
HTML标签
<% Java 程序段 %>
JSP标签
</body>
</html>
```page指令用于定义JSP页面中的全局属性,其中pageEncoding表示页面编码,iso-8859-1不支持中文编码,在写程序时注意改成***gb2312***





<div class="se-preview-section-delimiter"></div>

下面做一个简单的例子:
-----------

1.new->Web Project ->命名为testJSP
2.修改index.jsp,


<%
Date d=new Date();
int h=d.getHours();
if(h>12) out.print("Good afternoon");
else out.print("Good morning");
%>

Implementation process

1. The HTML markup (static part) in the JSP page is handed over to the client browser for direct display.
2. The server side executes the Java program (dynamic part) between <% and %>, and sends the execution
result to the client's browser for display.
3. The server side is also responsible for processing the relevant JSP tags and
sending to the client's browser.

The latest javaee content will be serialized later to record my learning process of javaee~~~

Guess you like

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