Pregunta

I am trying to decouple application-layer code from view layer html, css, js in a JSF 2.0 web application.

The view layer of the application will be a deployed WAR file with the standard structure.

The java code will be in a Weblogic deployed library (referenced by the war in WEB-INF/weblogic.xml). This will contain only the class files as well as many required jars.

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? These include: exception-handler-factory, resource bundle references, el-resolvers, listeners, render-kit, etc.

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.

¿Fue útil?

Solución

Yes, it's possible.

You can have an app library for commons, configuration and java code separate of the view-layer. 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. 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.

But, there are some issues to take in mind. For example, override a 3rd part, renderer or component.

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.

I hope, that resolve some of yours doubts...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top