![]()
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%!double r = 2, a = 3, b = 4, c = 5;%>
<br>
<jsp:include page="circle.jsp">
<jsp:param value="<%=r %>" name="name3" />
</jsp:include>
<br>
<jsp:include page="ladder.jsp">
<jsp:param value="<%=a %>" name="name1" />
<jsp:param value="<%=b %>" name="name2" />
<jsp:param value="<%=c %>" name="name3" />
</jsp:include>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'circle.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
String sideR = request.getParameter("name3");
double r = Double.parseDouble(sideR);
%>
<%!
public String getArea(double r) {
double area = r * r * 3.14;
return "" + area;
}%>
<br>
<br>
圆的半径是:<%=r%>
<br>
圆的面积是:<%=getArea(r)%>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'ladder.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
String name1 = request.getParameter("name1");
String name2 = request.getParameter("name2");
String name3 = request.getParameter("name3");
double a = Double.parseDouble(name1);
double b = Double.parseDouble(name2);
double c = Double.parseDouble(name3);
%>
<%!
public String getArea(double a, double b, double c) {
double area = ((a + b) * c) / 2;
return "" + area;
}%>
<br>
<br>
梯形的上底、下底、高是:
<%=name1%>
<%=name2%>
<%=name3%>
<br>
梯形的面积是:
<%=getArea(a, b, c)%>
</body>
</html>