You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Zied Hamdi <ja...@gmail.com> on 2007/12/17 12:29:43 UTC

[jsf][gravel][facelets][tobago] How can we define a comp id namespace?

Hi,

I have a problem with reusability of components: I have many jsf template
pages that I use everywhere throughout my app. The problem is that when
I define explicitely the ids of my UIComps, name collisions occur.

The question is: is there a way to define a sort of "namespace component
holder" so that my components have ids of type *page:namespace1:namespace2
:realComponentId*
this whould be the id of a component like this:
<tc:page id="*page*">
   <f:namespace id="*namespace1*">
     <f:namespace id="*namespace2*">
      <tc:out id="*realComponentId*"/>
    </f:namespace>
  </f:namespace>
</tc:page>

To be more explicit about the problem: Today I'm passing in every include a
parameter (idSuffix) that I append to the id:

*clientPage.xhtml*
<ui:include src="compPage.xhtml">
  <ui:param name="idSuffix" value="clientPage">
</ui:include>

*compPage.xhtml*
<tc:in id="personsTree#{idSuffix}" />

what is even more tedious is when I use another template in the included
template itself. I must pass idSuffix through :
  <ui:param name="idSuffix" value="#{idSuffix}">


So does a namespace feature exist in standard JSF maybe tobago, or
maybe gravel?

Regards,
Zied

Re: [jsf][gravel][facelets][tobago] How can we define a comp id namespace?

Posted by Zied Hamdi <ja...@gmail.com>.
Thank you Simon,

I'll remove all my ugly code with id construction :-).

Regards,
Zied


2007/12/17, simon <si...@chello.at>:
>
>
> On Mon, 2007-12-17 at 12:29 +0100, Zied Hamdi wrote:
> > Hi,
> >
> > I have a problem with reusability of components: I have many jsf
> > template pages that I use everywhere throughout my app. The problem is
> > that when I define explicitely the ids of my UIComps, name collisions
> > occur.
> >
> > The question is: is there a way to define a sort of "namespace
> > component holder"
>
> Yes, it's called f:subview. Just wrap that around every include
> statement.
>
> Interestingly, I thought that facelets did this automatically, and that
> f:subview was only needed for jsp includes. But obviously I'm wrong..
>
> Regards,
>
> Simon
>
>


-- 
Zied Hamdi
zatreex.sourceforge.net

Re: [jsf][gravel][facelets][tobago] How can we define a comp id namespace?

Posted by simon <si...@chello.at>.
On Mon, 2007-12-17 at 12:29 +0100, Zied Hamdi wrote:
> Hi,
>  
> I have a problem with reusability of components: I have many jsf
> template pages that I use everywhere throughout my app. The problem is
> that when I define explicitely the ids of my UIComps, name collisions
> occur.
>  
> The question is: is there a way to define a sort of "namespace
> component holder"

Yes, it's called f:subview. Just wrap that around every include
statement.

Interestingly, I thought that facelets did this automatically, and that
f:subview was only needed for jsp includes. But obviously I'm wrong..

Regards,

Simon