Skip to main content

JSF Tip #43 - Package a composite component

Posted by mriem on November 20, 2013 at 12:58 PM PST

If you want to share a composite component between projects you should package it in a JAR.

But how would you do it? Well it is pretty easy. First include the resources in the META-INF/resources directory. E.g.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns=""
            This is coming from a JAR-packaged composite component! Hurray :)

And then add a faces-config.xml in the META-INF directory. E.g.

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

<faces-config version="2.1"


And then JAR it all up.

Note the code for this sample is available as part of the Glassfish samples (see the subversion repository at

And that is it.


Related Topics >>