新手求教,向数据库提交信息时出错。
不是自己写的代码,从一本书上照抄的实例,可是执行到这个用户注册提交信息的页面时就出错。
该jsp文件代码如下
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<%@ page contentType= "text/html; charset=gb2312 " %>
<%@ page import= "XiaoYuJob.util.*,java.sql.*,javax.servlet.http.HttpServletRequest "%>
<%//request.setCharacterEncoding( "GB2312 ");%>
<jsp:useBean id= "jobSeeker " class= "XiaoYuJob.job.JobSeeker " scope= "request " />
<!--构造jobSeeker类的对象 jobSeeker-->
<jsp:setProperty name= "jobSeeker " property= "* "/>
<!--设置对象jobSeeker的属性-->
<%
DealString str=new DealString();
ShowErrorBox show=new ShowErrorBox();
out.print( "sssss "+jobSeeker.getSusername());
if(jobSeeker.getPassword().equals( " ")||jobSeeker.getEmail().equals( " ")||jobSeeker.getBirthday().equals( " ")){
out.print(show.errorBox( "请添写完整信息! ", "错误信息 "));
return;
}else{
if(jobSeeker.getSusername().compareTo( "z ")> =0||jobSeeker.getSusername().compareTo( "0 ") <=0){
out.print(show.errorBox( "注册用户名不允许为特殊字符和汉字! ", "错误信息 "));
return;
}
/* DataBaseConn dbc=new DataBaseConn();
try
{
java.sql.Statement st=dbc.getStmt();
String sql= "INSERT INTO t_jobSeeker(auserName,trueName,age,sex,birthday, "+
"school,specialty,knowledge,email,resume) VALUES( ' "+
jobSeeker.getSusername()+ " ', ' "+
str.toGb(jobSeeker.getStruename())+ " ', ' "+jobSeeker.getAge()+ " ', ' "+
jobSeeker.getSex()+ " ', ' "+jobSeeker.getBirthday()+ " ', ' "+
str.toGb(jobSeeker.getSchool())+ " ', ' "+
str.toGb(jobSeeker.getSpecialty())+ " ', '