JSF Composite Component

Posted by purecharger on Stack Overflow See other posts from Stack Overflow or by purecharger
Published on 2010-04-15T22:12:29Z Indexed on 2010/04/15 22:43 UTC
Read the original article Hit count: 474

Filed under:
|
|

I'm trying to create a composite component for use in my Seam application, and I'm running into problems with the simplest "hello, world" component.

I have placed a file named hello.xhtml in {jboss deploy}/application.ear/application.war/resources/greet :

<!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://java.sun.com/jsf/html"
  xmlns:composite="http://java.sun.com/jsf/composite">
<head>
<title>My First Composite Component</title>
</head>
<body>

<composite:interface>
    <composite:attribute name="who"/>
</composite:interface>

<composite:implementation>
    <h:outputText value="Hello, #{cc.attrs.who}!"/>
</composite:implementation>

</body>
</html>

Now in home.xhtml, located at the root of my webapp ({jboss deploy}/application.ear/application.war/home.xhtml):

<!DOCTYPE html 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:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:g="http://java.sun.com/jsf/composite/greet"
            xmlns:s="http://jboss.com/products/seam/taglib"
            template="layout/template.xhtml">
    <ui:define name="content">
    <div id="content">
        <g:hello who="World"/>
        <br/>
    </div>
    </ui:define>
</ui:composition>

But my "hello, world" is not displayed, and I dont get any error messages, even when I turn on debug level logging for com.sun and javax.faces categories.

Any ideas?

© Stack Overflow or respective owner

Related posts about jsf

Related posts about composite