You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Niklas Ekman <ni...@gmail.com> on 2006/11/06 20:11:27 UTC

Resource bundles

Hello,

I'm using MyFaces 1.1.4 and Facelets 1.1.11. I've created a main web
application project. I've also created a component library project where I
want to place custom components.

The problem I have is that I get a resource bundle clash. In a component I
declare a resource bundle with <f:loadBundle basename="component.messages"
var="msg" />. It works very well in itself. But when I include the component
on a page with the tag <f:loadBundle basename="app.messages" var="msg" /> I
get a bundle clash. I read the specs and it says that the <f:loadBundle/>
places the resource bundle in a bean with the request scope. I suspect that
the component and the page share the same bean "space". So the problem I
have is, how can I have unique resource bundles in my components?

Best regards,

Niklas

Re: Resource bundles

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Niklas,

I suppose you could pass an attribute into your facelets-component like this:

<myns:mycomp id="test"/>

and then use this id as a name for the msg:

<f:loadBundle var="#{id}"/>

not tested, not guaranteed to work ;)

regards,

Martin

On 11/6/06, Niklas Ekman <ni...@gmail.com> wrote:
> Hello,
>
> I'm using MyFaces 1.1.4 and Facelets 1.1.11. I've created a main web
> application project. I've also created a component library project where I
> want to place custom components.
>
> The problem I have is that I get a resource bundle clash. In a component I
> declare a resource bundle with <f:loadBundle basename=" component.messages"
> var="msg" />. It works very well in itself. But when I include the component
> on a page with the tag <f:loadBundle basename="app.messages" var="msg" /> I
> get a bundle clash. I read the specs and it says that the <f:loadBundle/>
> places the resource bundle in a bean with the request scope. I suspect that
> the component and the page share the same bean "space". So the problem I
> have is, how can I have unique resource bundles in my components?
>
> Best regards,
>
> Niklas
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces