Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSF2 EL html输出 出身背景_Jsf - Fatal编程技术网

JSF2 EL html输出 出身背景

JSF2 EL html输出 出身背景,jsf,Jsf,我有一个依赖JSF2的现有web应用程序。在大多数页面中,都有从各种属性文件输出文本的表达式。某些属性可能包含html。然而,JSF表达式将html转义为纯文本。我找到的解决方案是将escape设置为false。由于需要包装的表达式数量太多,因此使用它会很麻烦 问题 我的问题是,有没有办法将所有表达式配置为不转义html?如果我是你,我会创建自己的复合组件,可以在xhtml中使用 只需将此自定义组件添加到defautjsf文件夹src/webapp/components中的新xhtml文件中 比

我有一个依赖JSF2的现有web应用程序。在大多数页面中,都有从各种属性文件输出文本的表达式。某些属性可能包含html。然而,JSF表达式将html转义为纯文本。我找到的解决方案是将escape设置为false。由于需要包装的表达式数量太多,因此使用它会很麻烦

问题
我的问题是,有没有办法将所有表达式配置为不转义html?

如果我是你,我会创建自己的复合组件,可以在xhtml中使用

只需将此自定义组件添加到defautjsf文件夹src/webapp/components中的新xhtml文件中

比如:

src/webapp/components/myComponents/outputText.xhtml 不要忘记在使用组件的xhtml页面中添加followwing名称空间xmlns:field=http://java.sun.com/jsf/composite/components/myComponents 在ui:composition标签中


希望这有助于……

我理解。但是,这对我来说不起作用,因为我不能遍历每一页并用替换{expression}。如果是这样的话,我就用它。谢谢你。是的,我知道这一点。但是,html不是由用户设置的,而是由有权访问属性文件的第三方设置的。
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:cc="http://java.sun.com/jsf/composite">

    <cc:interface>
        <cc:attribute name="value" required="true"/>
    </cc:interface>

    <cc:implementation>
            <h:outputText value="#{cc.attrs.value}" escape="false"/>
    </cc:implementation>

</ui:composition>