如何在JSP中的两个变量之间插入空格? [英] How to insert a space between two variables in JSP?
问题描述
< c:forEach var = entryitems =$ {set}>
< input type =checkboxname =thingvalue =$ {entry.key} $ {entry.value}>
< / c:forEach>
然而,键和值之间的空间 $ {entry.key提交表单时,} $ {entry.value}
会丢失。我已经尝试在
之前使用 \
,在这种情况下, \ 和
在提交时仍然存在。
Java EL似乎不保留孤立的空间,是吗?如果是这样,是否有一个有效的解决方法?
编辑:这是如此愚蠢的我,非常感谢克苏鲁。但是我还是不明白添加 \
后的行为。为什么会导致空间显示?
您可以使用以下内容插入空格:& nbsp;
编辑:似乎是空间处理方式中的一个错误EL语法分析器,所以你应该使用html实体,比如& nbsp;
或其他概述 此处 。
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?
You can insert white-spaces using:
Edit: Seems to be a bug in the way spaces are handled by the EL parser, so you should use either html entities like
or the other ways outlined here.
这篇关于如何在JSP中的两个变量之间插入空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!