jsp插入mysql没成功_jsp往mysql数据库插入数据出错

我从网上下了段jsp添加数据的代码,自己运行时却一直出错,求各位高人指点一下前面是一段html表单代码,就不贴了,这是jsp的代码

我从网上下了段jsp添加数据的代码,自己运行时却一直出错,求各位高人指点一下

前面是一段html表单代码,就不贴了,这是jsp的代码

this.i = myBean.getSum() + 1;

this.cheng = myBean.setDate(this.id,this.title,this.source,this.content,this.sender);

out.println("

"+this.cheng + "

");

out.println("现在数据库中的总记录数为:"+i);

myBean.closeDate();//关闭对数据库的操作

%>

刚才插入的数据如下:

然后是一个javabean操作数据库的

package MyBean;

import java.io.*;

import java.sql.*;

public class liao

{

String driver,url,user,pwd,SQL;

Connection con;//连接对象

Statement stat;//SQL语句对象

ResultSet rs;//结果集对象

String id,title,source,content,sender;//取数据库中的数据用到

String newid,newtitle,newsource,newcontent,newsender;//插入数据到数据库中用到

int number;//记录当前结果集数据总行数

……

然后是一个javabean操作数据库的

package MyBean;

import java.io.*;

import java.sql.*;

public class liao

{

String driver,url,user,pwd,SQL;

Connection con;//连接对象

Statement stat;//SQL语句对象

ResultSet rs;//结果集对象

String id,title,source,content,sender;//取数据库中的数据用到

String newid,newtitle,newsource,newcontent,newsender;//插入数据到数据库中用到

int number;//记录当前结果集数据总行数

……

问题是当我提交表单数据后出错提示

org.apache.jasper.JasperException: 无法编译JSP

An error occurred at line: 33 in the jsp file: /incept.jsp

Generated servlet error:

The method setDate(String, String, String, String, String, String) in the type liao is not applicable for the arguments (String, String, String, String, String)

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

上面提示说类里面有六个参数,可是我找来找去也找不到第六个参数,怎么回事,帮帮我 !!麻烦各位了,如果满意我还会另加分

http://hi.baidu.com/%B7%A8%B2%BC%C0%D7%BC%D3%C4%DA%CC%D8%C0%EF/blog/item/019f8a3e68f212ca7d1e71ec.html

受字数限制不能发,就发个链接

这是javabean完整代码

怎么没显示……

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值