编写三个JSP页面存在同一Web服务目录中。请大虾们帮帮小弟啊 我用的是myEclipse
编写三个JSP页面:main.jsp,circle.jsp和ladder.jsp,将三个JSP页面保存在同一Web服务目录中。main.jsp使用include动作标记加...
编写三个JSP页面:main.jsp,circle.jsp和ladder.jsp,将三个JSP页面保存在同一Web服务目录中。main.jsp使用include动作标记加载circle.jsp和ladder.jsp页面。circle.jsp页面可以计算并显示圆的面积。当circle.jsp和ladder.jsp被加载时获取 main.jsp 页面 include动作标记的param子标记提供的圆的半径以及梯形的上低和下底还有高的值。
展开
2013-04-10
展开全部
main.jsp<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<body>
<jsp:include page="circle.jsp">
<jsp:param name="radii" value="5"/>
</jsp:include><br>
<jsp:include page="ladder.jsp">
<jsp:param name="up" value="5"/>
<jsp:param name="down" value="5"/>
<jsp:param name="high" value="5"/>
</jsp:include>
</body>
</html>circle.jsp<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<body>
<%
double area=Math.pow(Double.parseDouble(request.getParameter("radii")),2)*2*3.14;
%>
圆的面积为:<%= area%>
</body>
</html>
ladder.jsp<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<body>
<%
double up=Double.parseDouble(request.getParameter("up"));
double down=Double.parseDouble(request.getParameter("down"));
double high=Double.parseDouble(request.getParameter("high"));
double area=(up+down)*high/2;
%>
梯形的面积为:<%= area%>
</body>
</html>
<html>
<body>
<jsp:include page="circle.jsp">
<jsp:param name="radii" value="5"/>
</jsp:include><br>
<jsp:include page="ladder.jsp">
<jsp:param name="up" value="5"/>
<jsp:param name="down" value="5"/>
<jsp:param name="high" value="5"/>
</jsp:include>
</body>
</html>circle.jsp<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<body>
<%
double area=Math.pow(Double.parseDouble(request.getParameter("radii")),2)*2*3.14;
%>
圆的面积为:<%= area%>
</body>
</html>
ladder.jsp<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<body>
<%
double up=Double.parseDouble(request.getParameter("up"));
double down=Double.parseDouble(request.getParameter("down"));
double high=Double.parseDouble(request.getParameter("high"));
double area=(up+down)*high/2;
%>
梯形的面积为:<%= area%>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询