Jsf facelets完全脱离了xml

Jsf facelets完全脱离了xml,jsf,facelets,Jsf,Facelets,我总是这样使用el表达式 <h:outputText value="#{bean.value}" escape="true" />; 我无法在输入字段中从xml中转义: <h:inputText value="#{bean.value}" /> 有没有一种方法可以在facelets中完全转义xml 例如,上下文参数 <context-param> <param-name>facelets.ESCAPE_XML</param-name&

我总是这样使用el表达式

<h:outputText value="#{bean.value}" escape="true" />;
我无法在输入字段中从xml中转义:

<h:inputText value="#{bean.value}" />
有没有一种方法可以在facelets中完全转义xml

例如,上下文参数

<context-param>
  <param-name>facelets.ESCAPE_XML</param-name>
  <param-value>false</param-value>
</context-param>
覆盖渲染器并注释掉其转义文本的部分。然后在faces.config.xml中注册渲染器

当然,这只有在使用该标记时才起作用。如果您只输出一个表达式,例如{bean.value},它将不起作用


就个人而言,我宁愿坚持添加转义属性。

没有尝试过,但您可以使用自定义转换器,如bellowConverts\n to

在faces-config.xml中注册转换器

<converter>
    <description>Converts data to be displayed in web format
    </description>
     <converter-id>BreakLineConverter</converter-id>
    <converter-class>comp.web.converter.BreakLineConverter</converter-class>
</converter>

默认情况下,h:outputText和h:inputText都已转义XML实体。在h:inputText中甚至不能像在h:outputText中那样关闭它。你的问题在别的地方。也许您对escape XML的理解/定义是错误的。另外,您的示例建议您要禁用XML转义。对于h:inputText,您不能这样做,因为您的Web应用程序将很容易出现错误。你不想拥有它。

完全转义xml是什么意思?我不知道你想做什么。顺便说一句,escape=true是h:outputText的默认值。
<converter>
    <description>Converts data to be displayed in web format
    </description>
     <converter-id>BreakLineConverter</converter-id>
    <converter-class>comp.web.converter.BreakLineConverter</converter-class>
</converter>