<jsp:element name="input">
<jsp:attribute name="type">radio</jsp:attribute>
<jsp:attribute name="id">${status.index}${loop.index}</jsp:attribute>
<jsp:attribute name="name">skillLevel[${status.index}].skillLevelId</jsp:attribute>
<jsp:attribute name="value">${4 - loop.index}</jsp:attribute>
<c:if test = "${(4 - loop.index) == skillLevel.getSkillLevelId()}">
<jsp:attribute name="checked">checked</jsp:attribute>
</c:if>
</jsp:element>
显示错误c:如果标记不能在jsp:element标记内。我只想添加属性&#34; checked&#34;对于&#34;输入&#34;基于测试条件的元素。
答案 0 :(得分:0)
你试过这样的吗?
<c:if test = "${(4 - loop.index) == skillLevel.getSkillLevelId()}">
<c:set var="isChecked" value="checked"/>
</c:if>
<jsp:element name="input">
<jsp:attribute name="type">radio</jsp:attribute>
<jsp:attribute name="id">${status.index}${loop.index}</jsp:attribute>
<jsp:attribute name="name">skillLevel[${status.index}].skillLevelId</jsp:attribute>
<jsp:attribute name="value">${4 - loop.index}</jsp:attribute>
<jsp:attribute name="${isChecked}">${isChecked}</jsp:attribute>
</jsp:element>