日期:2014-05-17  浏览次数:20897 次

怎么也没看出问题,但就是运行不对。。。
目的:将一个index.jsp里的登录信息用AddInfo.jsp处理添加到数据库的表中。
数据库:db_userinfo
字段:id,username,userpassword,qqnum,qqpw,telphone,email
类:
package ui;

public class UserInfo {
private int id;
private String username;
private String userpassword;
private String qqnum;
private String qqpw;
private String telphone;
private String email;

//id
public int getId(){
return id;
}
public void setId(int id){
this.id=id;
}
//用户名
public String getUsername(){
return username;
}
public void setUsername(String username){
this.username=username;
}
//登录密码
public String getUserpassword(){
return userpassword;
}
public void setUserpassword(String userpassword){
this.userpassword=userpassword;
}
//QQ号码
public String getQqnum(){
return qqnum;
}
public void setqQnum(String qqnum){
this.qqnum=qqnum;
}
//QQ密码
public String getQqpw(){
return qqpw;
}
public void setQqpw(String qqpw){
this.qqpw=qqpw;
}
//手机
public String getTelphone(){
return telphone;
}
public void setTelphone(String telphone){
this.telphone=telphone;
}
//邮箱
public String getEmail(){
return email;
}
public void setEmail(String email){
this.email=email;
}
}


index.jsp代码:
<form action="AddInfo.jsp" method="post" onsubmit="return check(this);">
<table align="center" width="450">
<tr>
<td align="center" colspan="2" height="40">
<b>user info</b>
</td>
</tr>
<tr>
<td align="right">username:</td>
<td>
<input type="text" name="username">
</td>
</tr>

<tr>
<td align="right">userpassword:</td>
<td>
<input type="password" name="userpassword">
</td>
</tr>

<tr>
<td align="right">qqnum:</td>
<td>
<input type="text" name="qqnum">
</td>
</tr>

<tr>
<td align="right">qqpw:</td>
<td>
<input type="password" name="qqpw">
</td>
</tr>

<tr>
<td align="right">telephone:</td>
<td>
<input type="text" name="telphone">
</td>
</tr>

<tr>
<td align="right">email:</td>
<td>
<input type="text" name="email">
</td>
</tr>

<tr>
<td align="center" colspan="2">
<input type="submit" value="add">
</td>
</tr>
</table>
</form>


AddInfo.jsp代码:
<jsp:useBean id="userinfo" class="ui.UserInfo"></jsp:useBean>
<jsp:setProperty property="*" name="userinfo"/>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%
try{
Class.forName("com.mysql.jdbc.D