错误解析/page.xhtml: Error Traced[line: 42] The entity "nbsp"被引用,但未声明 [英] Error Parsing /page.xhtml: Error Traced[line: 42] The entity "nbsp" was referenced, but not declared

查看:32
本文介绍了错误解析/page.xhtml: Error Traced[line: 42] The entity "nbsp"被引用,但未声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 JSF 页面中使用不间断空格.我知道,在纯 HTML 中,我可以为此使用   并且这很好用.但是,当我将那些   放在 Facelets 页面中时,它会出现如下错误:

I'd like to use non breaking spaces in my JSF page. I know, in plain HTML I could use   for this and this works fine. However, when I put those   in a Facelets page, then it errors as follows:

错误解析/page.xhtml: Error Traced[line: 42] 实体nbsp"被引用,但未声明.

Error Parsing /page.xhtml: Error Traced[line: 42] The entity "nbsp" was referenced, but not declared.

这是怎么引起的,我该如何解决?

How is this caused and how can I solve it?

推荐答案

Facelets 是一种基于 XML 的视图技术.XML 只有五个预定义实体.  不在其中.它仅适用于纯 HTML 或遗留 JSP(注意:它不适用于 JSPX,因为它也是基于 XML 的!).

Facelets is a XML based view technology. XML has only five predefined entities. The   is not among them. It works only when used in plain HTML or in legacy JSP (note: it doesn't work in JSPX as that's also XML based!).

要解决此问题,您需要自己在包含   实体的 XHTML 文件的 doctype 中声明实体,

To fix this, you either need to declare the entity yourself in the doctype of the very XHTML file containing the   entity,

<!DOCTYPE html [
    <!ENTITY nbsp "&#160;"> 
]>

或者,最好使用(十六进制)十进制表示法:

or, better, use the (hexa)decimal notation instead:

&#xA0; or &#160;

在一般的 IDE 中,执行在所有文件中查找和替换"并用 &#xA0; 替换每次出现的 &nbsp; 应该是微不足道的>.

In an average IDE it should be trivial to perform a "find and replace in all files" and replace every occurrence of &nbsp; by &#xA0;.

这篇关于错误解析/page.xhtml: Error Traced[line: 42] The entity &quot;nbsp&quot;被引用,但未声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆