1

After setting <%@page trimDirectiveWhitespaces="true"%>, all the whitespace is stripped, even the space between ${a} ${b}.

How can I produce some whitespace in my JSP? Like the space between ${a} ${b} ?

==EDIT==

I know why the spaces are stripped, and I know that the official 'solution' is to "wrap the desired spaces in <jsp:text>", but that impacts readability of my code. Would like to know if there is a more concise solution.

rustyx
  • 80,671
  • 25
  • 200
  • 267
  • Possible duplicate: http://stackoverflow.com/q/2935093/413020 and valid answer: http://stackoverflow.com/a/2935380/413020. In summary: use `` – Alberto Apr 20 '15 at 16:03
  • [THE DOCTOR](http://stackoverflow.com/users/70015/the-doctor)'s answer also works for me – Alberto Apr 20 '15 at 16:10

2 Answers2

2

You could get around this by using the JSTL c:out tag: <c:out value="${a} ${b}" />

THE DOCTOR
  • 4,399
  • 10
  • 43
  • 64
2

For now I'm using this code to print out a space: ${' '}

Like this: ${a} ${' '} ${b}

rustyx
  • 80,671
  • 25
  • 200
  • 267