注册时,获取不到struts标签中的gender值_html/css_WEB-ITnose

WBOY
Lepaskan: 2016-06-21 09:29:22
asal
1464 orang telah melayarinya

性       别:					<s:select list="#{'1':'男','2':'女'}" cssClass="msg" name="gender"></s:select>					<br/><br/>					         					<input id="zc" class="btn" type="submit" value="注册 "/>
Salin selepas log masuk



javabean


package cn.itcast.domain;import java.sql.Date;public class Employee {   private Integer id; //编号  private String loginName;//登陆名  private String password;//登陆密码  private String name; //姓名  private Integer gender;//性别  private Date birthday;//生日  private Date entryDate;//入职日期  private String empNO;//员工号   private Department department;	public Employee() {		super();			}	public Integer getId() {		return id;	}	public void setId(Integer id) {		this.id = id;	}	public String getLoginName() {		return loginName;	}	public void setLoginName(String loginName) {		this.loginName = loginName;	}	public String getPassword() {		return password;	}	public void setPassword(String password) {		this.password = password;	}	public String getName() {		return name;	}	public void setName(String name) {		this.name = name;	}	public Integer getGender() {		return gender;	}	public void setGender(Integer gender) {		this.gender = gender;	}	public Date getBirthday() {		return birthday;	}	public void setBirthday(Date birthday) {		this.birthday = birthday;	}	public Date getEntryDate() {		return entryDate;	}	public void setEntryDate(Date entryDate) {		this.entryDate = entryDate;	}	public String getEmpNO() {		return empNO;	}	public void setEmpNO(String empNO) {		this.empNO = empNO;	}	public Department getDepartment() {		return department;	}	public void setDepartment(Department department) {		this.department = department;	}  }
Salin selepas log masuk


数据库中为空,注册时,获取不到值,其它属性正常



回复讨论(解决方案)

性别用单选框就行了;

性别 <s:radio label="性别" list="#{'男':'男','女':'女'}" name="sex"></s:radio>
Salin selepas log masuk

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan