JSF相关问题 [英] Jsf Related Issue
问题描述
我遇到了一些问题:h:outputText和h:inputText都在显示值,但是它们将多个空格折叠为单个空格
I am getting issue somthing h:outputText and h:inputText both are displaying values but they are collapse the multiple whitespaces into single white space
为此,我尝试使用style ="white-space:pre"但也无法正常工作 所以我要添加 在字符串之间
for that i tried with style="white-space:pre" but it also not working so i am adding in between strings
String str ="hi& nbsp jsf"和
String str="hi & nbsp jsf" and
在显示时会在输入文本框中显示值"hi& nbsp; jsf",而不是"hi jsf".因此,我应该做些什么,以使其不显示& nbsp;".
while displaying it shows in input text box with value "hi & nbsp ;jsf" not "hi jsf" So, what should i have to do so that that it will display without "& nbsp;"
实际上,我已经在& nbsp;因为在这里它将替换为空白
actually i have put that space between & nbsp; because here it will replaceing with white space
我不希望使用escape ="false"进行显示,因为在某些地方我需要h:inputText.在h:inputText中,没有转义属性选项
I don't want with escape="false" for displaying because at some place i need h:inputText. In h:inputText there is no option for escape attribute
任何其他永久解决空白空间的问题
any other permanent solution for white Space Issue
推荐答案
您需要使用nbsp的代码,因为nbsp不是像html页面那样自动声明的实体.
代码为 160 ,因此您可以使用 
.
另外,您可以在页面顶部声明一个实体,如下所示:
You need to use the code of nbsp, because nbsp is not an entity automatically declared like in html pages.
The code is 160, so you can use  
.
Alternatively, you can declare an entity at the top of your page like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
[<!ENTITY nbsp " ">]>
,您可以自由使用
这篇关于JSF相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!