日期:2014-05-18  浏览次数:20630 次

行行好,朋友们帮帮忙?
我写的一个Jsp文件,提交页面后出现下面的出错提示,我不知道错误出在那里?

org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP

An   error   occurred   at   line:   18   in   the   jsp   file:   /adver/adver_add_set.jsp
Generated   servlet   error:
D:\Tomcat\work\Catalina\localhost\ch26\org\apache\jsp\adver\adver_005fadd_005fset_jsp.java:114:   non-static   method   InsertNews(ch26.content)   cannot   be   referenced   from   a   static   context
                contentManage.InsertNews(contentinfo);
                                          ^
1   error


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:123)



------解决方案--------------------
contentManage的方法InsertNews()不是静态的
创建contentManager对象的实例然后再调用,或者把这个方法改成static类型。
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.html