<%@ 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 'main.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=5,a=1,b=2,c=3; %>
<jsp:include page="ladder.jsp">
<jsp:param name="t1name" value="<%=a %>"/>
<jsp:param name="t2name" value="<%=b %>"/>
<jsp:param name="t3name" value="<%=c %>"/>
</jsp:include>

<jsp:include page="circle.jsp">
<jsp:param name="y1name" value="<%=r %>"/>
</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 '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 s1=request.getParameter("t1name");
String s2=request.getParameter("t2name");
String s3=request.getParameter("t3name");
double a =Double.parseDouble(s1);
double b =Double.parseDouble(s2);
double c =Double.parseDouble(s3);
%>
<%!
public String getti(double a,double b,double c){
double ts = ((a+b)*c)/2;
return ""+ts;
}
%>
梯形的上底、下底、高分别为<%=a %>、<%=b %>、<%=c %><br>
梯形的面积是<%=getti(a,b,c) %><br>
</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 s=request.getParameter("y1name");
double r = Double.parseDouble(s);
%>
<%!
public String getyuan(double r) {
double area = r * r * 3.14;
return "" + area;
}
%>
圆的半径为<%=r %><br>
圆的面积是<%=getyuan(r)%>

</body>
</html>