Topic: 求助:有关jsp的问题 |
Print this page |
1.求助:有关jsp的问题 | Copy to clipboard |
Posted by: chenchao100 Posted on: 2006-07-11 21:50 我写了个jsp程序,可是执行不了,不知道是什么原因,也找不出错误,请高手帮帮忙啊!程序是这样的: <%@page contentType="text/html;charset=GB2312"%> <html> <body> <body bgcolor=cyan><font size=4> <p>请输入圆的半径: <form action="" method=get name=form> <input type="text" name="cat" value="1"> <input Type="submit" name="送出" value=submit></form> <%! public class Circle { double r; Circle (double r) { this.r=r; } double mianji { return Math.PI*2*r; } double zhouchang { return Math.PI*2*r; } } %> <% String str=request.getParameter("cat"); double r; if(str!=null) { r=Double.parseDouble(str); } else { r=1; } Circle circle=new Circle(r); %> <p>圆的半径是: <br> <%=circle.mianji()%> <p>圆的周长是: <br> <%=circle.zhouchang()%> </font> </body> </html> 可是执行后的对话框为内容为: HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 9 in the jsp file: /2_4.jsp Generated servlet error: Syntax error, insert ";" to complete FieldDeclaration An error occurred at line: 9 in the jsp file: /2_4.jsp Generated servlet error: Void methods cannot return a value An error occurred at line: 9 in the jsp file: /2_4.jsp Generated servlet error: Syntax error, insert ";" to complete FieldDeclaration An error occurred at line: 9 in the jsp file: /2_4.jsp Generated servlet error: Void methods cannot return a value An error occurred at line: 43 in the jsp file: /2_4.jsp Generated servlet error: The method mianji() is undefined for the type _2_005f4_jsp.Circle An error occurred at line: 46 in the jsp file: /2_4.jsp Generated servlet error: The method zhouchang() is undefined for the type _2_005f4_jsp.Circle org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs. -------------------------------------------------------------------------------- Apache Tomcat/5.5.9 |
2.Re:求助:有关jsp的问题 [Re: chenchao100] | Copy to clipboard |
Posted by: InTheTerRan Posted on: 2006-07-15 14:46 double mianji { return Math.PI*2*r; } double zhouchang { return Math.PI*2*r; } 函数申明怎么没有() ? 应该double mianji() double zhouchang() |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |