【问题标题】:JSF 2.0 and Weblogic 11 - Include faces-config specifications in referenced libraryJSF 2.0 和 Weblogic 11 - 在引用的库中包含 faces-config 规范
【发布时间】:2014-01-07 04:50:08
【问题描述】:

我正在尝试在 JSF 2.0 Web 应用程序中将应用层代码与视图层 html、css、js 分离。

应用程序的视图层将是一个已部署的具有标准结构的 WAR 文件。

java 代码将位于 Weblogic 部署的库中(由 WEB-INF/weblogic.xml 中的战争引用)。这将只包含类文件以及许多必需的 jar。

我不希望视图层的工作人员直接连接到应用层。我可以在引用库的 faces-config.xml 中包含来自应用程序的 faces-config.xml 的规范吗?其中包括:异常处理程序工厂、资源包引用、el-resolvers、侦听器、render-kit 等。

应用结构
    -应用层库
        -META-INF
            -faces-config.xml???
        -WEB-INF
            -类
            -lib(这里是罐子)
            -web.xml
    -View-Layer 应用程序
        -META-INF
        -WEB-INF
            -faces-config.xml
            -web.xml
            -weblogic.xml
            -weblogic-application.xml
         -其他文件夹

对不起,如果这还不够清楚,我在 Stack Overflow 上的第一个问题!如果我能澄清任何事情,请随时告诉我。

【问题讨论】:

    标签: java jsf jsf-2 weblogic11g faces-config


    【解决方案1】:

    是的,这是可能的。

    您可以拥有一个独立于视图层的公共、配置和 java 代码的应用程序库。在这个 jar(库)中,您将所需的所有内容放在位于 src/META-INF/faces-config.xml 的 JSF 配置文件 (faces-config.xml) 中。在我的情况下,我在这个配置文件中有异常处理程序工厂、资源包引用、el-resolvers、侦听器,并且在 weblogic 中没有任何问题。

    但是,有一些问题需要注意。例如,覆盖第三部分、渲染器或组件。

    Custom renderers which needs to override renderers of 3rd party component libraries needs to be registered in webapp's own faces-config.xml, not in a faces-config.xml which is packed in another JAR in /WEB-INF/lib as well. The loading order of JAR files is unspecified, so it may happen that the custom renderer is loaded and registered before the one of the 3rd party component library which you'd like to override, exactly like as you faced.

    希望能解决你的一些疑惑……

    【讨论】:

      猜你喜欢
      • 2011-06-02
      • 2012-04-28
      • 2016-10-23
      • 1970-01-01
      • 2012-03-11
      • 1970-01-01
      • 2013-06-16
      • 2022-01-13
      • 2013-04-14
      相关资源
      最近更新 更多