Skip to main content

JSF Tip #44 - Use a packaged composite component

Posted by mriem on November 21, 2013 at 11:31 AM PST

In the previous blog entry we set the stage on how to package a composite component in a JAR. Now we are going to use it!

Add the dependency to the POM

        <dependency>
            <groupId>org.glassfish-samples.jsf</groupId>
            <artifactId>packagedCompositeComponent</artifactId>
            <version>${project.version}</version>
        </dependency>

Use it in the page

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:mypanel="http://java.sun.com/jsf/composite/mypanel">
    <h:head>
        <title>Composite component</title>
    </h:head>
    <h:body>
        <h2>Composite component</h2>
        <mypanel:mypanel/>
    </h:body>
</html>

Note the code for this sample is available as part of the Glassfish samples (see the subversion repository at https://svn.java.net/svn/glassfish-samples~svn/trunk/ws/javaee7/jsf/usePackagedCompositeComponent/)

And that is it.

Enjoy!

Related Topics >>