创建User类
package user;
public class User
{
private int id;
private String name;
private String password;
private String sex;
private String email;
private String telephone;
private String address;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getSex() {
return sex;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
jsp页面使用Bean
<form action="1111.jsp" method="post">
<input type="text" id="name" name="name"><br>
<input type="text" id="address" name="address"><br>
<input type="text" id="id" name="id"><br>
<input type="submit" value="提交">
<jsp:useBean id="bn" class="USER.bn" scope="session"></jsp:useBean>
<jsp:setProperty name="bn" property="*"></jsp:setProperty>
<jsp:getProperty name="bn" property="id"/>
<jsp:getProperty name="bn" property="name"/>
<jsp:getProperty name="bn" property="address"/>