rustyx
rustyx

Reputation: 85286

How to produce whitespace after trimDirectiveWhitespaces="true"?

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.

Upvotes: 1

Views: 725

Answers (2)

rustyx
rustyx

Reputation: 85286

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

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

Upvotes: 2

THE DOCTOR
THE DOCTOR

Reputation: 4555

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

Upvotes: 2

Related Questions