How do I insert a non breaking space character in JSF page
like I can in HTML using
?
Is there such a tag in JSF?
You can use primefaces
library
<p:spacer width="10" />
You can also use primefaces <p:spacer width="10" height="10" />
You can use css:
style="margin-left: 5px;"
I found that the parser would complain if I used the
entity in my page. After a little research, I learned that if I added a DOCTYPE declaration to the beginning of the page, the entity was allowed. I use this DOCTYPE declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
A side effect of this is that the resulting code (as seen by using the "view source" feature of a web browser) doesn't actually contain the
entity. It instead includes the actual characters that represent a nonbreaking space. Although it works, it's not really what I want. I'm still looking for a way to make the parser not replace the entity with the character.
More information here: http://java.net/jira/browse/JAVASERVERFACES-1576
Eventually, you can try this one, if just using
fails...
<h:outputText value="& nbsp;" escape="false"/>
(like Tom, I added a space between &
and nbsp;
)