JSP第三次作业
main
<body> <jsp:include page="cricle.jsp"> <jsp:param value="4" name="R"/> </jsp:include> <br> <jsp:include page="ladder.jsp"> <jsp:param value="3" name="shangdi"/> <jsp:param value="2" name="xiadi"/> <jsp:param value="6" name="gao"/> </jsp:include> </body>
ladder
<body> <% String shangdi = request.getParameter("shangdi"); String xiadi = request.getParameter("shangdi"); String gao = request.getParameter("xiadi"); int shang = Integer.parseInt(shangdi); int xia = Integer.parseInt(xiadi); int g = Integer.parseInt(gao); out.println("上底为:" + shangdi + ",下底为:" + xiadi + ",高为:" + gao); out.print("梯形的面积为:" + ((shang + xia) * g) / 2); %> </body>
cricle
<body> <% String r = request.getParameter("R"); int R = Integer.parseInt(r); out.print("园的半径为:"+ r +" "+ "园的面积为:" + 3.14 * R * R); %> </body>