<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
pageContext.setAttribute("name","张三");
request.setAttribute("name","李四");
session.setAttribute("name","王五");
application.setAttribute("name", "赵六");
%>
<h1>当前页面获取值</h1>
<%= pageContext.getAttribute("name") %>
<%= request.getAttribute("name") %>
<%= session.getAttribute("ame") %>
<%= application.getAttribute("name")%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>获取四个范围的数据</h1>
<%= pageContext.getAttribute("name") %>
<%= request.getAttribute("name") %>
<%= pageContext.getAttribute("name",pageContext.REQUEST_SCOPE) %>
<%= session.getAttribute("name") %>
<%= pageContext.getAttribute("name",pageContext.REQUEST_SCOPE) %>
<%= application.getAttribute("name") %>
<%= pageContext.getAttribute("name",pageContext.APPLICATION_SCOPE) %>
<%
pageContext.setAttribute("name","张三");
pageContext.setAttribute("name","李四", pageContext.REQUEST_SCOPE);
pageContext.setAttribute("name","李四", pageContext.REQUEST_SCOPE);
pageContext.setAttribute("name","李四", pageContext.AALICATION_SCOPE);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>JSP的动作标签;转发</h1>
<jsp:forward page="/demo1/demo4">
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>demo4.jsp</h1>
<%= request.getParameter("name") %>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@ include file="Logo.jsp" %>
<%@ include file="menu.jsp" %>
<h1>Body</h1>
<%= i %>
<%@ include file="foot.jsp" %>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>EL执行运算</h1>
<%
pageContext.setAttribute("n1",10);
pageContext.setAttribute("n2",20);
%>
${ n1 + n2 + n3 }
<h3>执行算数运算</h3>
${ n1 < n2 } -- ${ n1 lt n2 }<br>
${ n1 > n2 } -- ${ n1 gt n2 }<br>
${ n1 == n2 } -- ${ n1 eq n2 }<br>
${ n1 >= n2 } -- ${ n1 ge n2 }<br>
${ n1 <= n2 } -- ${ n1 le n2 }<br>
${ n1 != n2 } -- ${ n1 ne n2 }<br>
<h3>执行逻辑运算</h3>
<%
pageContext.setAttribute("n3","30");
pageContext.setAttribute("n4","40");
%>
${ (n1 < n2) && (n3 < n4) -- ${ (n1 < n2) and (n3 < n4) }<br>
${ (n1 < n2) || (n3 < n4) -- ${ (n1 < n2) or (n3 < n4) }<br>
${ !(n1 < n2) } -- ${ not (n1 < n2) }<br>
<h3>执行三元算</h3>
${ n1 < n2 ? "n1小于n2" : "n1不小于n2" }
<h3>空运算符</h3>
${ empty user }<br>
${ not empty user }<br>
</body>
</html>