确实说的不清楚...不知道楼主是不是下面这个意思...
String checkValue = rs.getString("checkValue");<% if (checkValue != null && checkValue.equal("1")) {%>
<INPUT type=radio name="radio" CHECKED>
<% } else { %>
<INPUT type=radio name="radio">
<% } %>
String checkValue = rs.getString("checkValue");<% if (checkValue != null && checkValue.equal("1")) {%>
<INPUT type=radio name="radio" CHECKED>
<% } else { %>
<INPUT type=radio name="radio">
<% } %>
...
String itemValue = rs.getString("itemValue");
...
//form内设值
...
form.setItemValue(itemValue );
...
//jsp显示
...
<html:radio property="itemValue" value="show" />
...
那就这样了,如果从bean的itemValue属性中取出的值等于从"show",那么该radio将被选中.
...
String itemValue = rs.getString("itemValue");
...
//form内设值
...
form.setItemValue(itemValue );
...
//jsp显示
...
<html:radio property="itemValue" value="show" />
...
那就这样了,如果从bean的itemValue属性中取出的值等于从"show",那么该radio将被选中.
上面那段不要.
我想他的意思是:
你从ResultSet中得到东东,传递到一个相关的FormBean中去“form.setItemValue(itemValue );“。
然后用该值<html:radio property="itemValue" value="show" />
……
public String getitemValue() {
System.out.println("iV: "+itemValue);
return itemValue;
} public void setitemValue(String item) {
this.itemValue = item;
}
……jsp中
……
<%
u.setUserType("1");
u.getUserType();
%>
<html:radio property="itemValue" value="0" />
<html:radio property="itemValue" value="1" />
……在控制台打印出
iV:1
iV:0
iV:0
在页面上还是value为0的被选中,为什么它自己又变成0了???
<%
u.setUserType("1");
u.getUserType();
%>
<html:radio property="itemValue" value="0" />
<html:radio property="itemValue" value="1" />
这四行是连着的,中间不可能还有别的代码执行啊。
郁闷……