How do I make JSP tag files NOT ignore all whitespace?

 ̄綄美尐妖づ 提交于 2019-12-01 03:56:37

It's actually a bug in the EL parser which causes spaces in between EL expressions to be eaten. E.g.

${bean.foo} ${bean.bar} ${bean.waa}

would get printed as (assuming that they returns the very same String value as its property name is):

foobarwaa

I recall that this issue was reported somewhere before, but I can't seem to find it right now. As far now you can fix it by using JSTL c:out tag:

<c:out value="${bean.foo} ${bean.bar} ${bean.waa}" />

which correctly get printed as:

foo bar waa

Maybe put the jsp content in an html <pre> tag? This seems to me to be the right thing to do as the list is pre-formatted content.

I used &#32; entity instead of space but generally I think this sucks that either ALL whitespace is eaten and one has to hack with entities or you have vast space in the generated HTML code.

So you are saying your tag doesn't print out white space at all? Is there any whitespace for it to print out?

Can you post the code, and a short example of how you use it?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!