1、select控件
option一定要用<html:option>**</html:option> 若只用<option>则只能传值给formbean,但不能从formbean自 动赋值给select
2、radio控件
<html:radio property = "isHxbStuff" value="1" onclick="initValue()">是</html:radio>
<html:radio property = "isHxbStuff" value="0" onclick="initValue()">否</html:radio>
取值方法:
function initValue(){
var value="";
var rPort = document.getElementsByName("isHxbStuff"); //类似于数组
for(i=0;i<rPort.length;i++){
if(rPort[i].checked)
value=rPort[i].value; //得到选择的radio的值
}
}
本文详细介绍了Struts框架中select和radio两种表单控件的使用方法,包括如何正确使用这些控件与FormBean进行数据绑定及交互。特别强调了select控件中option标签的正确使用方式,并给出了radio控件的JavaScript取值示例。
333

被折叠的 条评论
为什么被折叠?



