JSP第三周作业
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <%!double r=4; %> <%!double s=4; %> <%!double x=6; %> <%!double h=5; %> <jsp:include page="circle.jsp"> <jsp:param value="<%=r %>" name="banjing" /> </jsp:include> <jsp:include page="ladder.jsp"> <jsp:param value="<%=s %>" name="shangdi"/> <jsp:param value="<%=x %>" name="xiadi"/> <jsp:param value="<%=h %>" name="gao"/> </jsp:include> </body> </html> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> 圆的半径: <%=request.getParameter("banjing") %> <br/><br/> <%! double getmj(double r){ double mj=r*r*3.14; return mj; } %> <% String r1=request.getParameter("banjing"); double r=Double.parseDouble(r1); %> 圆的面积:<%=getmj(r) %> <br/><br/><br/><br/> </body> </html> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> 上底: <%=request.getParameter("shangdi") %><br/><br/> 下底:<%=request.getParameter("xiadi") %><br/><br/> 高:<%=request.getParameter("gao") %><br/><br/> <%! double getmjj(double s,double x,double h){ double aarea=(s+x)*h/2; return aarea; } %> <% String s1=request.getParameter("shangdi"); double s=Double.parseDouble(s1); String x1=request.getParameter("xiadi"); double x=Double.parseDouble(x1); String h1=request.getParameter("gao"); double h=Double.parseDouble(h1); %> 梯形的面积: <%=getmjj(s,x,h) %> <br/><br/> </body> </html>