tandraschko / quarkus-myfaces

26 stars 6 forks source link

Does quarkus-myfaces support composite components ? #24

Closed tosuns closed 4 years ago

tosuns commented 4 years ago

Hi,

I'm currently testing the quarkus-myfaces extention and have an issue with composite components. As far as I can tell it seems like composite components are not rendered.

I created a composite component xhtml and placed it in the folder resources/META-INF/resources/components/view/simple-component.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://xmlns.jcp.org/jsf/composite">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="model"
                      type="com.junk.SimpleComponentBean"
                      required="true"/>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        #{cc.attrs.model.name}
    </cc:implementation>
</html>

and created a request scope bean org.junk.SimpleComponentBean


@Model
public class SimpleComponentBean {

    public String getName() {
        return "SimpleComponentBean->name";
    }

}

and used the composite component in the welcome page index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:view="http://xmlns.jcp.org/jsf/composite/components/view">
    <f:view contentType="text/html">
        <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>
            Hello from Facelets
            <view:simple-component model="#{simpleComponentBean}"/>
        </h:body>
    </f:view>
</html>

The rendered html is as follows

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
           xmlns:view="http://xmlns.jcp.org/jsf/composite/resources/components/view">
  <head id="j_id_4">
    <link type="text/css" rel="stylesheet" href="/javax.faces.resource/theme.css.xhtml?ln=primefaces-luna-amber" />
    <title>Facelet Title</title>
  </head>
  <body>
    Hello from Facelets: 
    <view:simple-component model="com.test.SimpleComponentBean@561f71d9"></view:simple-component>
    <script id="148642e2-591e-40c2-91d5-073f2084e282" type="text/javascript">var pf=window.PrimeFaces;if(pf){pf.settings.locale='de_DE';pf.settings.partialSubmit=true;pf.settings.projectStage='Development';};if(window.$){$(PrimeFaces.escapeClientId("148642e2-591e-40c2-91d5-073f2084e282")).remove();}</script>
  </body>
</html>

As you can see the composite component was not process and rendered. In the log I find the following lines

__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2020-09-10 14:37:27,152 INFO  [org.apa.myf.web.MyFacesContainerInitializer] (Quarkus Main Thread) Using org.apache.myfaces.webapp.MyFacesContainerInitializer
2020-09-10 14:37:27,948 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core Bean Validation support disabled
2020-09-10 14:37:28,177 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core CDI support enabled
2020-09-10 14:37:28,177 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core EL 3.0 support enabled
2020-09-10 14:37:28,181 INFO  [org.apa.myf.uti.ExternalSpecifications] (Quarkus Main Thread) MyFaces Core Servlet 4.0 support enabled
2020-09-10 14:37:28,252 INFO  [org.pri.web.PostConstructApplicationEventListener] (Quarkus Main Thread) Running on PrimeFaces 8.0
2020-09-10 14:37:28,258 INFO  [io.und.web.jsr] (Quarkus Main Thread) UT026005: Adding programmatic server endpoint class org.apache.myfaces.push.EndpointImpl for path /javax.faces.push/{channel}
2020-09-10 14:37:28,342 WARNING [org.apa.myf.web.AbstractFacesInitializer] (Quarkus Main Thread) 

********************************************************************
*** WARNING: Apache MyFaces Core is running in DEVELOPMENT mode. ***
***                                            ^^^^^^^^^^^       ***
*** Do NOT deploy to your live server(s) without changing this.  ***
*** See Application#getProjectStage() for more information.      ***
********************************************************************

2020-09-10 14:37:28,343 INFO  [org.apa.myf.web.StartupServletContextListener] (Quarkus Main Thread) MyFaces Core has started, it took [1186] ms.
2020-09-10 14:37:29,784 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-jsf-test 0.1 on JVM (powered by Quarkus 1.7.2.Final) started in 9.712s. Listening on: http://0.0.0.0:8080
2020-09-10 14:37:29,785 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2020-09-10 14:37:29,786 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, jdbc-postgresql, mutiny, myfaces, narayana-jta, resteasy, resteasy-jackson, servlet, smallrye-context-propagation, undertow-websockets, vertx, vertx-web]
2020-09-10 14:37:36,792 WARNING [org.apa.myf.lif.RenderResponseExecutor] (executor-thread-1) There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are: 
- Warning: The page /index.xhtml declares namespace http://xmlns.jcp.org/jsf/composite/components/view and uses the tag view:simple-component , but no TagLibrary associated to namespace. Please check the namespace name and if it is correct, it is probably that your library .taglib.xml cannot be found on the current classpath, or if you are referencing a composite component library check your library folder match with the namespace and can be located by the installed ResourceHandler.

Did I provide a wrong namespace ? The IDE complains if a specify another namespace and is only satisfied with the one I used.

rmpestano commented 4 years ago

Hi, I have these composite components inside a jar which are used in a quarkus app here: https://adminfaces-adminfaces.apps.ca-central-1.starter.openshift-online.com/pages/layout/sidebar.xhtml

Maybe you can compare with yours.

Also one thing that have is a taglib xml here but I don't know it's necessary

tandraschko commented 4 years ago

Also note that this repo is closed. If you have a myfaces issue, use the JIRA and provide a complete sample project to reproduce, otehrwise i cant help.