多个radio只要名字name相同,那么他们就是一组
然后在你的Action中,private String xxxx;
xxxx是与你的一组radio的name相同,那么你选择哪一个
然后在你的Action中,private String xxxx;
xxxx是与你的一组radio的name相同,那么你选择哪一个
String xxxx里面的值就是被选中的那个radio的value值
XXX.jsp
<table id="RadioButtonList1" border="0">
<tr>
<td>
<input id="RadioButtonList1_0" type="radio"
name="RadioButtonList" value="办公室人员" checked="checked"
tabindex="3" />
<label for="RadioButtonList1_0">
办公室
</label>
</td>
<td>
<input id="RadioButtonList1_1" type="radio"
name="RadioButtonList" value="仓库管理员" tabindex="3" />
<label for="RadioButtonList1_1">
仓管
</label>
</td>
<td>
<input id="RadioButtonList1_2" type="radio"
name="RadioButtonList" value="客户" tabindex="3" />
<label for="RadioButtonList1_2">
客户
</label>
</td>
<td>
<input id="RadioButtonList1_3" type="radio"
name="RadioButtonList" value="访客" tabindex="3" />
<label for="RadioButtonList1_3">
访客
</label>
</td>
</tr>
</table>
public class UserDto {
/*
* 数据传输对象,用于与用户有关的功能,如登录
* @author johnny
* time 2011-12-28
*/
private String name;
private String password;
private String RadioButtonList ;
public UserDto() {
}
//-------------------------getter&&setter---------------------
UserAction
public String login()throws Exception{
System.out.println("-----------user login ing-------------");
String name=userDto.getName();
String password = userDto.getPassword();
String radioButtonList = userDto.getRadioButtonList();
System.out.println("RadioButtonList-----"+radioButtonList);