Generally your component will be putting something in the page so can
you just check the DOM for a known element? If you can only have one
of the component in the page then it should be safe to use a fixed
element id and then you can call
"writer.getDocument().getElementById("special-fixed-component-id");"
from beginRender(MarkupWriter writer). if the element exists then
throw an exception or whatever.

On Wed, Sep 15, 2010 at 3:24 PM, Alessio Gambi <[email protected]> wrote:
> Hi,
>
> I'm trying to find an elegant way in T5.1 to ensure that a page contains one 
> and only once instance of a given component.
>
> My initial idea was to define a base page class that has the logic to render 
> the component using the Component annotation, and to check for duplicates of 
> the same component (to remove them or to generate an exception). 
> Unfortunately, I was no able to get it working properly, I get either an 
> exception during the rendering phase or the template of that component is not 
> rendered at all.
>
> I though about using an approach similar to the layout component as a 
> workaround, thus avoiding the inheritance among pages, but I prefer to use 
> thus approach as B-plan.
>
> Do you have any suggestion ?
>
> Thanks
>
> -- Alessio
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to