html select option tag closes itself due to a "/" character in the dynamic value (JSP, JSTL)

Posted by saky on Stack Overflow See other posts from Stack Overflow or by saky
Published on 2010-04-07T11:34:28Z Indexed on 2010/04/07 11:43 UTC
Read the original article Hit count: 429

Filed under:
|
|
|
<select id="ordersSelect" class="drop-down" onchange="somemethod()"> 

<c:forEach items="${orders}" var="order" varStatus="orderStatus">
  <option value="${order.id}"> ${order.publicId} </option>
</c:forEach>

</select>

I have the above peice of code in a JSP page, that receives a list of Orders and each order has some information, the particular information that I want to display in a SELECT field is the publicId.

The problem is that, on display there is only one OPTION in the SELECT and the rest of the order's publicId s are displayed as normal text below the SELECT box and not an OPTION to select.


I found out that the publicId actually contains a String like A10/0001/0 and that is the character "/" is most probably causing the problem.

Any solutions/suggestion/ideas?

© Stack Overflow or respective owner

Related posts about jsp

Related posts about jstl