展开全部
rect.jsp
<form action="com.jsp">
宽:<input name="width"></input>
高:<input name="height"></input>
<input type="submit" value="提交"/>
</form>
com.jsp
<%
String width = request.getParameter("width");
String height = request.getParameter("height");.
int w = Integer.parseInt(width==null||"".equals(widht)?"0":width);
int h = Integer.parseInt(height==null||"".equals(height)?"0":height);
int area = w*h;
%>
面积为<%=String.valueOf(area) %>
<form action="com.jsp">
宽:<input name="width"></input>
高:<input name="height"></input>
<input type="submit" value="提交"/>
</form>
com.jsp
<%
String width = request.getParameter("width");
String height = request.getParameter("height");.
int w = Integer.parseInt(width==null||"".equals(widht)?"0":width);
int h = Integer.parseInt(height==null||"".equals(height)?"0":height);
int area = w*h;
%>
面积为<%=String.valueOf(area) %>
追问
亲,周长没有哎~~求周长、、
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询