Introduction to JSP

1. What is JSP?

1. Full name: Java Server Pages

2. Purpose: Responding to client requests

3. Suffix: file.jsp

4. How to create a jsp page: [myeclipse2016 as an example]

New project----"Right-click the project---"New----"Select JSP (Advanced Templates)---"Enter the name (name in English)----"Click finish .

5. How to turn the front HTML page into a JSP page:

Copy all the HTML code, and save the code covering the JSP page <!DOCTYPE html> to the end.

Remember to modify charset to UTF-8:

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>

Second, the code example

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'a.jsp' starting page</title>
  </head>
  
  <body>
    HELLO,WELCOME TO MY JSP PAGES!<br>
  </body>
</html>



Guess you like

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