我有一个 JSP 页面,我在其中将所选单选按钮的表单和值保存在数据库中。现在,我需要更新该页面,所有内容都在显示,但未选中单选按钮。我不知道如何在我的 jsp 上显示以前选择的单选按钮。我正在使用 Struts2,Java。
JSP代码:
<div id="patientCondition">
<input type="radio" id="new" value="n" name="pSB.radioInnerSubjective" /><label for="new">New</label>
<input type="radio" id="noChange" value="nC" name="pSB.radioInnerSubjective" /><label for="noChange">No Change</label>
<input type="radio" id="progressing" value="p" name="pSB.radioInnerSubjective" /><label for="progressing">Progressing</label>
<input type="radio" id="notProgressing" value="nP" name="pSB.radioInnerSubjective" /><label for="notProgressing">Not Progressing</label>
</div>
假设我从数据库中获取单选按钮的值为“nC”,现在如何自动选择第二个单选按钮。
我试过:
<input type="radio" id="new" value="n" <s:if test="${patientSoapBean.radioInnerSubjective == 'n'}">CHECKED</s:if> name="patientSoapBean.radioInnerSubjective"/><label for="new">New</label>
但我收到错误:
Mar 28, 2013 6:07:54 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /WEB-INF/views/patient_soap.jsp (line: 703, column: 44) According to TLD or attribute directive in tag file, attribute test does not accept any expressions