package com.media.bean;
public class user {
private String name;
private String xuehao;
private String zhuanye;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getXuehao() {
return xuehao;
}
public void setXuehao(String xuehao) {
this.xuehao = xuehao;
}
public String getZhuanye() {
return zhuanye;
}
public void setZhuanye(String zhuanye) {
this.zhuanye = zhuanye;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
<form action="denglu.jsp" method="get">
用户名:<input type="text" id="name" name="name"><br>
学号:<input type="text" id="xuehao" name="xuehao"><br>
专业:<input type="text" id="zhuanye" name="zhuanye"><br>
年龄:<input type="text" id="age" name="age"><br>
<input type="submit" value="注册">
</form>
<jsp:useBean id="user" class="com.media.bean.user" scope="session"></jsp:useBean>
<jsp:setProperty name="user" property="*"></jsp:setProperty>
<jsp:getProperty name="user" property="name"/>
<jsp:getProperty name="user" property="xuehao"/>
<jsp:getProperty name="user" property="zhuanye"/>
<jsp:getProperty name="user" property="age"/>