一、jsp声明
在jsp程序段中变量必须先定义后使用,其使用方法如下:
<%! 代码 %>
下面的declaration01.jsp是一个简单的例子,代码如下:
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2022/2/25
Time: 14:21
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>jsp声明</title>
</head>
<body>
<%
String str="你好";
%>
<%
out.print(str);
%>
</body>
</html>
运行结果如下:
二、url传值