关于调用javabean入库的问题
两个JSP页面
con_register.jsp表单提交
adduser_do.jsp接受表单并入库
三个javabean文件
DataBaseConnection.java数据连接
User.java获取表单数据
UserBean.java获取User数据入库
现在的问题是adduser_do.jsp调用UserBean时就404错误!
###################################################################
con_register.jsp代码(略)
adduser_do.jsp主要代码如下:
###################################################################
<jsp:useBean id= "user " class= "com.plus.contribute.User " scope= "page ">
<jsp:setProperty name= "user " property= "* "/>
</jsp:useBean>
<jsp:useBean id= "userBean " class= "com.plus.contribute.UserBean " scope= "page "/>
<%
userBean.addUser(user);
%>
#################################################################
DataBaseConnection.java代码如下:
#################################################################
package com.plus.util;
import java.sql.*;
//连接数据库的工具类。
public class DataBaseConnection
{
/**
*一个静态方法,返回一个数据库的连接。
*这样达到了对数据库连接统一控制的目的。
*/
public static Connection getConnection()
{
Connection con=null;
String CLASSFORNAME= "oracle.jdbc.driver.OracleDriver ";
String SERVANDDB= "jdbc:oracle:thin:@localhost:1521:skyzip ";
String USER= "skyzip ";
String PWD= "skyzip ";
try
{
Class.forName(CLASSFORNAME);
con = DriverManager.getConnection(SERVANDDB,USER,PWD);
}
catch(Exception e)
{
e.printStackTrace();
}
return con;
}
}
##############################################################
User.java
##############################################################
package com.plus.contribute;
import java.io.Serializable;
import java.io.*;
public class User implements Serializable {
/* 私有字段 */
private String userid;
private String username;
private String passwd;
private String question;
private String key;
private String name;
private String sex;
private String email;
private String userphone;
private String address;
private String regtime;
private String lgotime;
private String check;
/* JavaBean属性访问方法 */
public String getUserid()
{
return userid;
}
public void setUserid(String userid)
{
this.userid = userid;
}
.