我从网上下了段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完整代码
怎么没显示……
展开