这是一段输入求阶乘的jsp代码这里是代码和运行截图。,tomcat里的request jar包也导入过了,请教大神问题出在哪了。<%@ page contentType="text/html; charset=GBK"%><html> <head> <title>计算阶乘</title> </head> <body> <form action="jiecheng.jsp"method="get"name="form"><input type="text"name="radius"> <input type="submit"name="submit"value="开始计算"></form> <%!void jiecheng(){ String str =request.getParameter("radius"); double num=Double.parseDouble(str); for(int i = 1;i < 6;i++){ int n = 1; for(int j = 1;j < i+1;j++){ n = n * j; } num = num + n; } System.out.println(num); } %> <%jiecheng(); %> <p>所求的阶乘是:<%=jiecheng() %> </body></html>
添加回答
举报
0/150
提交
取消