在 struts 1.2 中,我如何根据我的数据库值突出显示单选按钮?我正在使用 Form bean 来设置其他文本字段值。
<tr>
<td align = "right" nowrap>SEX:</td>
<td align= "right" nowrap> <html:radio property="sex" value="male"/>MALE
<html:radio property="sex" value="female"/>FEMALE</td>
</tr>
我正在使用以下 java 代码的表单 bean:stuform.setSex((String)tempmap.get("SEX"));
这里的 stuform 是 StudentForm 类的对象,tempmap 包含来自选择查询的数据。
最佳答案
您可以使用 if 语句,我使用的是 jSTL if 语句,但您也可以使用标签。
<c:if test="${myForm.sex=='female'}">
<html:radio property="sex" value="female"/><span style="color: red;">FEMALE</span></td>
</c:if>
关于java - 从数据库中检索数据并用单选按钮显示它,单选按钮包含 struts 1.2 中的数据值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17146961/