webtier@glassfish.java.net

Re: [webtier] Resource Management in JSF 2.0

From: Joel Weight <digitaljoel_at_gmail.com>
Date: Sun, 25 Apr 2010 09:29:05 -0600

Ryan's first entry in the series has a large section on packaging which has
great detail on pretty much everything you would need to know about how to
put the resource (image, javascript, css) in a jar, and even version it. It
says:

The default implementation will look for resources in two locations
and in the following order:


   1. */resources* this location represents resources in the webapp itself
   and if present, must be in the root of the web application
   2. */META-INF/resources* this location represents resources on the
   classpath


Then, in my blog (yes it's mine and I was surprised to see you link to it :)
it says:

In order to redistribute those components, you simply add them to a jar
under META-INF/resources, and then make sure that your META-INF directory
also contains a faces-config.xml file.

So, if you put your resources in META-INF/resources you should be able to
reference them. Optionally, and I would highly recommend it, you can put
them within a library, which is simply another directory under
META-INF/resources, something like META-INF/resources/images and then
"images" is your library. I believe it will only look in jars that contain
a faces-config.xml file, so make sure you have one of those in your jar
within the META-INF directory. The faces-config.xml file doesn't need to
contain anything other than what is shown in my blog. Then you should be
able to include the jar as a library within your web project and references
the resources.

Joel

On Sun, Apr 25, 2010 at 6:11 AM, <webtier_at_javadesktop.org> wrote:

> Thanks Vladimir,
> I read the blog carefully and looked through everywhere but one question
> still remains and that is how to package a list of resources in a jar file
> in a way that the jar file could be considered as a resource package and can
> be used as a resource in my JSF.
> Bests
> Youness
> [Message sent by forum member 'youness_teimoury']
>
> http://forums.java.net/jive/thread.jspa?messageID=398903
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>