webtier@glassfish.java.net

Re: [webtier] How to package composite components for re-use?

From: Joel Weight <digitaljoel_at_gmail.com>
Date: Fri, 11 Dec 2009 15:02:56 -0700

Thank you Jason, that worked like a charm.

Joel


On Fri, Dec 11, 2009 at 1:57 PM, Jason Lee <jasondlee_at_sun.com> wrote:

> My guess is that you're moving the CC from a war to a jar. If that's the
> case, you need to have a faces-config.xml in META-INF in the jar. It can be
> "empty," though, by which I mean it must have the root facesp-config element
> with the version set to 2.0. If that's not there, JSF will not scan the jar
> for resources, annotations, etc.
>
>
> On 12/11/09 2:46 PM, Joel Weight wrote:
>
>> I'm sorry if this is a simple question. I've spent the morning on Google
>> looking for a blog post or something without any luck.
>>
>> Let's say I have a set of composite components in my webapp. I am now
>> creating a new webapp and want to use those same components in both. Rather
>> than copying the resources directory from one webapp to another, I would
>> like to have some library that I can just include in each, and then maintain
>> that library separately, package it in a jar, and simply include it within
>> each webapp project. How do I package the .xhtml files in the library so
>> they can be used within each webapp? I tried creating a jar with the
>> following structure
>>
>> META-INF/resources/adc/core/echo.xhtml
>>
>> then having an xmlns as follows in a page within the project
>>
>> xmlns:ac="http://java.sun.com/jsf/composite/adc/core"
>>
>> and referencing the tag as
>>
>> Here's the external echoer!
>> <ac:echo value="Echo Me" />
>> <br/>
>> and here's one with the default value
>> <ac:echo/>
>>
>>
>> Any help would be greatly appreciated.
>>
>> Joel
>>
>>
>> For reference, here's the entire echoer component
>>
>> <?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://java.sun.com/jsf/html"
>> xmlns:composite="http://java.sun.com/jsf/composite">
>>
>> <!-- INTERFACE -->
>> <composite:interface>
>> <composite:attribute name="value" default="Empty" />
>> </composite:interface>
>>
>> <!-- IMPLEMENTATION -->
>> <composite:implementation>
>> Echo <h:outputText value="#{cc.attrs.value}" /> Echo
>> </composite:implementation>
>> </html>
>>
>
>
> --
> Jason Lee
> Senior Java Developer
> GlassFish Administration Console
>
> Sun Microsystems, Inc.
> Phone x31197/+1 405-343-1964
> Email jasondlee_at_sun.com
> Blog http://blogs.sun.com/jasondlee
> Blog http://blogs.steeplesoft.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>