Reputation: 4899
Hi this drop down menu
<td class="selectBox"><select name="questionType" id="questionType" disabled=""><option value="">--Select--</option><option value="1"id="1">text</option><option value="2"id="2">rating</option><option value="3"id="3">boolean</option><option value="4"id="4">option</option></select></td>
and its created dynamically using jstl
'<td class="selectBox"><select name="questionType" id="questionType" disabled=""><option value="">--Select--</option><c:forEach items="${questionTypes}" var="questionType"><option value="${questionType.id}"id="${questionType.id}">${questionType.name }</option></c:forEach></select></td>';
Now I want to give a class "show-checkboxes" to one of the drop down whose value is option
<option value="4"id="4" class="show-checkboxes">option</option>
so I did this jstl
'<td class="selectBox"><select name="questionType" id="questionType" disabled=""><option value="">--Select--</option><c:forEach items="${questionTypes}" var="questionType"><c:choose><c:when tes="${questionType.name.equals("option")}"><option class ="show-checkboxes" value="${questionType.id}"id="${questionType.id}">${questionType.name }</option></c:when><c:otherwise><option value="${questionType.id}"id="${questionType.id}">${questionType.name }</option></c:otherwise></c:choose></c:forEach></select></td>';
but its not working
Can any body please tell me the error?
Upvotes: 1
Views: 1411
Reputation: 46841
Replace
<c:when tes="${questionType.name.equals("option")}">
with
<c:when test="${questionType.name eq \"option\"}">
OR
<c:when test="${questionType.name eq 'option'}">
You are using double quotes inside double quotes that is causing the issue.
Find a sample code here JSTL Core c:when Tag
Upvotes: 1
Reputation: 1349
In tag
<c:when tes="${questionType.name.equals("option")}">
the word test is missing last letter. It might be cause of strange behaviour.
Upvotes: 0