简体   繁体   English

JSF 2.0和Weblogic 11-在引用的库中包含faces-config规范

[英]JSF 2.0 and Weblogic 11 - Include faces-config specifications in referenced library

I am trying to decouple application-layer code from view layer html, css, js in a JSF 2.0 web application. 我正在尝试从JSF 2.0 Web应用程序中的视图层html,css,js分离应用程序层代码。

The view layer of the application will be a deployed WAR file with the standard structure. 应用程序的视图层将是具有标准结构的已部署WAR文件。

The java code will be in a Weblogic deployed library (referenced by the war in WEB-INF/weblogic.xml). 该Java代码将位于Weblogic部署的库中(战争引用在WEB-INF / weblogic.xml中)。 This will contain only the class files as well as many required jars. 这将仅包含类文件以及许多必需的jar。

I don't want the people working on the view layer to have direct connection to the application layer. 我不希望在视图层工作的人员直接与应用程序层建立联系。 Can I include specifications normally from the faces-config.xml of the application inside the referenced library's faces-config.xml instead? 我是否可以正常地从引用库的faces-config.xml中包含应用程序的faces-config.xml中的规范? These include: exception-handler-factory, resource bundle references, el-resolvers, listeners, render-kit, etc. 其中包括:异常处理程序工厂,资源束引用,el-resolver,侦听器,render-kit等。

Application Structure
    -App-Layer Library
        -META-INF
            -faces-config.xml???
        -WEB-INF
            -classes
            -lib (jars here)
            -web.xml
    -View-Layer Application
        -META-INF
        -WEB-INF
            -faces-config.xml
            -web.xml
            -weblogic.xml
            -weblogic-application.xml
         -Other folders

Sorry if this is not clear enough, my first question on Stack Overflow! 抱歉,如果还不够清楚,我的第一个问题就是堆栈溢出! Please feel free to let me know if I can clarify anything. 如果可以澄清任何问题,请随时告诉我。

Yes, it's possible. 是的,有可能。

You can have an app library for commons, configuration and java code separate of the view-layer. 您可以拥有一个与视图层分开的用于公用,配置和Java代码的应用程序库。 In this jar (library) you put all that you need at the JSF config file, ( faces-config.xml ) located in src/META-INF/faces-config.xml . 在这个jar(库)中,将所需的所有内容放在src/META-INF/faces-config.xml中的JSF配置文件( faces-config.xml )中。 In my case i have exception-handler-factory, resource bundle references, el-resolvers, listeners in this config file, and don't have any problem in weblogic. 就我而言,我在此配置文件中具有异常处理程序工厂,资源包引用,el-resolver,侦听器,并且在weblogic中没有任何问题。

But, there are some issues to take in mind. 但是,要记住一些问题。 For example, override a 3rd part, renderer or component. 例如,覆盖第3个零件,渲染器或组件。

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. 需要覆盖第3方组件库的渲染器的自定义渲染器需要在webapp自己的faces-config.xml中注册,而不是在/ WEB-INF / lib中的另一个JAR中打包的faces-config.xml中注册。 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. JAR文件的加载顺序是不确定的,因此,可能会发生以下情况:自定义渲染器已在您要覆盖的第三方组件库之一进行加载和注册,就像您面对的一样。

I hope, that resolve some of yours doubts... 希望能解决您的一些疑问...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM