自己写的一个jsp文件在eclipse下运行正常,但是把后缀改成html就无法正常运行了,请教下怎么回事

自己写的一个jsp文件在eclipse下运行正常,但是把后缀改成html就无法正常运行了,请教下怎么回事 题目是这个: 编写一个JSP程序,计算1!+2!+3!+4!+5!,并显示出结果。要求先声明计算阶乘的方法,再调用该方法,最后在页面上输出结果。 进阶要求,通过表单提交一个正整数,然后计算它的阶乘和。例如:输入3,就计算1!+2!+3! 下面是自己的代码: <%@ page contentType="text/html;charset=gb2312"%> <html> <body> <p>请输入数字:</p> <form action="dec-method.jsp" method="get" name="form"> <input type="text" name="radius"> <input type="submit"value="开始计算"> </form> <%!double a1(double r) { double x=1; for(int i=1;i<=r;i++){ x=x*i; } return x; } %> <%!double b1(double a) { double x=0; for(int i=1;i<=a;i++){ x=x+a1(i); } return x; } %> <% String str = request.getParameter("radius"); if (str != null) { try { double r; r = Double.parseDouble(str); %> <p>阶乘和是:<%=b1(r)%> <% } catch (Exception e) { out.print(e.getMessage()); } } %> </body> </html> 新手刚刚上路,求指导谢谢

这两个是不一样的,jsp是服务器页面,html是服务器解析后的页面,或者是静态页面,无法用动态jsp的脚本,他们有本质的区别
温馨提示:答案为网友推荐,仅供参考
大家正在搜