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

往数据库插入记录的问题
代码
我的代码
<%    
        String   wuliao=request.getParameter( "textfield ");
String   pinming=request.getParameter( "textfield2 ");
String   shulian=request.getParameter( "textfield3 ");
String   danjia=request.getParameter( "textfield5 ");
String   jine=request.getParameter( "textfield6 ");
String   jiaoqi=request.getParameter( "textfield4 ");
String   gongyinshang=request.getParameter( "textfield7 ");
String   sql= "insert   into   wuliao(wuliao,pinming,shulian,danjia,jine,jiaoqi,gongyinshang)   values( "+wuliao+ ", ' "+pinming+ ", ' "+shulian+ ", ' "+danjia+ ", ' "+jine+ ", ' "+jiaoqi+ ", ' "+gongyinshang+ " ') ";
int   result=0;
result=connBean.executeUpdate(sql);
if   (result!=0){
out.println( " <script   language= 'javascript '> alert( '写入成功! ');window.location.href= 'index.jsp '; </script> ");
}else{
out.println( " <script   language= 'javascript '> alert( '写入失败! ');window.location.href= 'Topic_add.jsp '; </script> ");
out.print(wuliao+pinming+shulian+danjia+jine+jiaoqi+gongyinshang);
  %>  
知道这是什么错误吗   我往数据库插入记录发生的
org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP:  


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



------解决方案--------------------
connBean.executeUpdate
这个connBean应该是你用类文件了

你什么都不放,只放这个
<jsp:useBean id= "connBean " scope= "page " class= "这里是你的类 " />

你只放这一句看好不好使!
------解决方案--------------------
看上去是源代码某个地方语法错误

引号可能是错误来源
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.aiyiweb.com/j2ee/2308.html