<%@ 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>當(dāng)前頁(yè)面獲取值</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>獲取四個(gè)范圍的數(shù)據(jù)</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的動(dòng)作標(biāo)簽;轉(zhuǎn)發(fā)</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執(zhí)行運(yùn)算</h1>
<%
? pageContext.setAttribute("n1",10);
? pageContext.setAttribute("n2",20);
%>
${ n1 + n2 + n3 }
<h3>執(zhí)行算數(shù)運(yùn)算</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>執(zhí)行邏輯運(yùn)算</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>執(zhí)行三元算</h3>
${ n1 < n2 ? "n1小于n2" : "n1不小于n2" }
<h3>空運(yùn)算符</h3>
${ empty user }<br>
${ not empty user }<br>
</body>
</html>