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

前端 未结 4 563
轮回少年
轮回少年 2021-01-12 04:22

I\'m really stumped on this one. I want to output a list and have the tag file take care of commas, singular versus plural, etc. but when I display the list it completely ig

4条回答
  •  天涯浪人
    2021-01-12 04:48

    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:

    
    

    which correctly get printed as:

    foo bar waa
    

提交回复
热议问题