cal.html
<html>
<body>
<form name="form1" method="post" action="docal.jsp">
<center>
请输入直角边1的长:<input type = "text" name = "arg1">
<br>
请输入直角边2的长:<input type = "text" name = "arg2">
<br>
<input type = "submit" name = "计算">
</center>
</form>
</body>
</html>
docal.jsp
/*如何算一个直角三角形的 面积,首先要取三角形的两个直角边长,面积是两个直角边长之积的1/2;*/
<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body>
<center>
<font size="20" color="blue">
<%
int a=Integer.parseInt(request.getParameter("arg1"));
int b=Integer.parseInt(request.getParameter("arg2"));
int s=a*b/2;
out.print("直角三角形边1的长度是:"+a+"<br>");
out.print("直角三角形边2的长度是:"+b+"<br>");
out.print("直角三角形的 面积是:"+s+"<br>");
%>
</font>
</center>
</body>
</html>
posted on 2009-05-03 11:05
鹏凌 阅读(1012)
评论(0) 编辑 收藏