webtier@glassfish.java.net

JSF 2 How to resolve Resource URLs in UIComponents

From: <webtier_at_javadesktop.org>
Date: Sun, 28 Mar 2010 02:42:16 PDT

Hello,

In JSF 2, a great EL shortcut was introduced to get the url for resources using #resource['/library/image.jpg'].

I would like to get the URL of an image inside a custom component using an equivalent java syntax. The image resource lies inside [i]META-INF/resources/library[/i], and I couldn't find any convenient way of referencing the path of image when writing an "img" tag inside my UIComponent.

I have been looking around [i]facesContext.getApplication().getResourceHandler()[/i], but resource handler has no such method to find a resource in META-INF/resources.

Please let me know what is the best method of resolving such resources inside a component.

Thanks
[Message sent by forum member 'razib']

http://forums.java.net/jive/thread.jspa?messageID=394105