Class LoadBundle

  • All Implemented Interfaces:

    public class LoadBundle
    extends TagHandler

    The <o:loadBundle> taghandler basically extends the standard <f:loadBundle> with a new loader attribute allowing you to explicitly set the desired ClassLoader where the resource bundle should be looked up. Also the Locale of the bundle is obtained with better default values than the default Faces implementation.

    You can use the loader attribute to specify an object whose class loader will be used to load the resource bundle specified in the basename attribute. The class loader of the given object is resolved as specified in Utils.getClassLoader(Object). In the end this should allow you to use a more specific resource bundle when there are duplicate instances in the runtime classpath, e.g. via multiple (plugin) libraries.

    The locale of the resource bundle is obtained as specified in Faces.getLocale().


    You can use it the same way as <f:loadBundle>, you only need to change f: into o: to get the extra support for loader attribute and the improved locale resolving.

    Bauke Scholtz
    • Constructor Detail

      • LoadBundle

        public LoadBundle​(TagConfig config)
        The tag constructor.
        config - The tag config.
    • Method Detail

      • apply

        public void apply​(FaceletContext context,
                          UIComponent parent)
                   throws IOException
        First obtain the resource bundle by its name as specified in the basename attribute with the locale which is obtained as specified in Faces.getLocale() and the class loader which is obtained as specified in Utils.getClassLoader(Object) with the loader attribute as argument. Finally set the resource bundle in the request scope by the name as specified in the var attribute.