【java寒假打卡】javaweb-jsp-爱代码爱编程
概述
JSP的快速入门
<%--
Created by IntelliJ IDEA.
User: Admini
Date: 2023/1/23
Time: 20:58
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<%-- 浏览器默认打开index.jsp文件--%>
<h1> 这是一个jsp文件</h1>
</body>
</html>
JSP的执行过程
JSP文件本质是JAVA文件
JSP的语法
<%--
Created by IntelliJ IDEA.
User: Admini
Date: 2023/1/23
Time: 20:58
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<%
out.println("Hello JSP");
%>
<%-- 相当于输出语句--%>
<%="HELLO"%>
<%-- JSP的声明--%>
<% String s = "abc";%>
<%-- 输出声明的变量--%>
<%=s%>
</body>
</html>