<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>
Shows error that c:if tag cant be within jsp:element tag. I just want to add the attribute "checked" for the "input" element based on the test condition.
Have you tried like this ?
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.