大家 帮我看看这段把数据插入到NYSQL数据库中的语句,哪错拉?谢谢!

ppxjsp 2004-10-26 11:08:28
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url="jdbc:mysql://127.0.0.1/dbname?user=accounts&password=password&useUnicode=true&characterEncoding=gb2312";
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
string title=newstring(request.getparameter("title").getbytes("8859_1"));

String sql = "insert into gb(title) values('"+title+"')" ;
stmt.executeUpdate(sql) ;
%>
success!
<%
rs.close();
stmt.close();
conn.close();
%>
...全文
69 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
xmbareheaded 2004-10-26
string title=newstring(request.getparameter("title").getbytes("8859_1"));
改为:
String title=newstring(request.getparameter("title").getbytes("8859_1"));
大写"String"
回复
ppxjsp 2004-10-26
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: 1 in the jsp file: /message/gbadd+deal.jsp

Generated servlet error:
[javac] Compiling 1 source file

/usr/local/jakarta-tomcat-4.1.29-LE-jdk14/work/Standalone/www1.ajiadi.com/_/message/gbadd_0002bdeal_jsp.java:48: cannot resolve symbol
symbol : class string
location: class org.apache.jsp.gbadd_0002bdeal_jsp
string title=newstring(request.getparameter("title").getbytes("8859_1"));
^



An error occurred at line: 1 in the jsp file: /message/gbadd+deal.jsp

Generated servlet error:
/usr/local/jakarta-tomcat-4.1.29-LE-jdk14/work/Standalone/www1.ajiadi.com/_/message/gbadd_0002bdeal_jsp.java:48: cannot resolve symbol
symbol : method getparameter (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
string title=newstring(request.getparameter("title").getbytes("8859_1"));
^
2 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.29-LE-jdk14
回复
0242891 2004-10-26
你这个rs.close();多出来了
回复
xhuad 2004-10-26
把错误的信息贴出来
回复
ppxjsp 2004-10-26
还有一个错误呢
回复
ppxjsp 2004-10-26
exception

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

An error occurred at line: 1 in the jsp file: /message/gbadd+deal.jsp

Generated servlet error:
[javac] Compiling 1 source file

/usr/local/jakarta-tomcat-4.1.29-LE-jdk14/work/Standalone/www1.10020.com/_/message/gbadd_0002bdeal_jsp.java:48: cannot resolve symbol
symbol : method getparameter (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
String title=newstring(request.getparameter("title").getbytes("8859_1"));
^
1 error

回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告