main.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
  </head>
  
  <body>
    <jsp:include page="circle.jsp" flush="true">
    <jsp:param  name="radius" value="3"/>
    </jsp:include>
    <br>
    <jsp:include page="ladder.jsp">
    <jsp:param value="2" name="shang"/>
    <jsp:param value="2" name="xia"/>
    <jsp:param value="2" name="gao"/>
    </jsp:include>
  </body>
</html>

circle.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title>My JSP 'circle.jsp' starting page</title>
  </head>
  
  <body>
   <%
  String a=request.getParameter("radius");
  double b=Double.parseDouble(a);
  double PI=3.14;
  out.print("圆面积:"+(PI*b*b));
   %>
   
   
   
  </body>
</html>

ladder.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
  </head>
  
  <body>
   <%
  String a=request.getParameter("shang");
  String b=request.getParameter("xia");
  String c=request.getParameter("gao");
  double d=Double.parseDouble(a);
  double e=Double.parseDouble(b);
  double f=Double.parseDouble(c);
  out.print("梯形面积:"+((d+e)*f/2));
   %>
  </body>
</html>

 

posted on 2020-03-24 09:41  Suzy安  阅读(93)  评论(0编辑  收藏  举报