- 编写两个页面parctice.jsp和computer.jsp,在页面practice.jsp中使用include动作标标记动态包含文件computer.jsp,并向它传递一个矩形的长和宽;computer收到参数后计算矩形的面积,并显示结果
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>计算矩形的面积</h1>
<jsp:include page="computer.jsp">
<jsp:param value="18" name="chang"/>
<jsp:param value="10" name="kuan"/>
</jsp:include>
</body>
</html>
我是被包含的页面负责计算面积:
矩形的长是<%=c%><br>
矩形的宽是<%=k%><br>
矩形面积<%=mj %> <br>
3.P125 例4-10
<% @ page language = "java" pageEncoding = "gbk"%>
<% @ taglib uri = "http://java.sun.com/jstl/core_rt" prefix = "c"%>
<html>
<head>
<title> JSP 测试</title>
</head>
<body>
c:set var="example" value=" $ (100+1]"scope="session"/>
example =<c:out value= "$ {example}"/>
</body >
</html>