This question already has an answer here:
- How do I make JSP tag files NOT ignore all whitespace? 4 answers
I have one line of html in a form on a JSP page like this:
<c:forEach var="entry" items="${set}">
<input type="checkbox" name="thing" value="${entry.key} ${entry.value}">
</c:forEach>
However, the space between the key and the value ${entry.key} ${entry.value}
is lost when the form is submitted. I've tried using a \
before the , in that case both the
\
and the are still there when submitting.
It seems that Java EL does not preserve isolated spaces, is that right? If so, is there a valid workaround?
EDIT: This is so silly of me, many thanks to Cthulhu. But I still don't understand the behavior after adding a \
. Why would that cause the space to show?