I have a page where I am trying to display full name (firstName lastName) on the browser.
In my JSP, I have
<span>
<c:if test="${someCondition1}">
<c:out value="${firstName}">
</c:if>
<c:if test="${someCondition2}">
<c:out value="${lastName}">
</c:if>
</span>
Now there are some code indentation spaces inside the span element. The issue is that in Firefox, the code spaces are not collapsed, while IE collapses them.
Also I tried using the various CSS white-space properties ;normal, wrap, -moz-pre-wrap, etc
But this does not seem to be working for some reason.
Also I might not be able to use the white-space property to fix this, since I can have multiple spaces within the firstName/lastName as well which should be displayed as it is e.g. first Name can be
"my First Name"
Thus using CSS white-space on the span element to collapse multiple spaces would be wrong.
You can replace your spaces with
firstName = firstName.replace(" ", " ");
With this you don't need your CSS white-space anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With