you can communicate values using the Environment class (push and
pop/peek methods)
or by injecting the ServletRequest and set/getAttribute... so you dont
have to (ab)use the
dom document for something like this

On Thu, Sep 16, 2010 at 09:17, Alessio Gambi <agamb...@gmail.com> wrote:
> Hi Josh,
>
> thanks.
>
> As you suggested I defined a special-fixed-component-id for the component
> and I checked before its rendering (during its own SetupRender) if that id
> was already present
> in the document (writer.getDocument().getElementById()). If so I just
> skipped the render (by returning False) and everything is fine.
>
> However, this solution will not scale easily for different constraints.
> Assume for example that you want to force one of the following constraints
> in the page (not all of them may have real use cases):
>
> - N and only N components of the same type, N > 1
> - No components of type X
>
> I guess you can always work with the Document object and look for some IDs
> (maybe a programmatic way to do that will scale better).
> Moreover, I noticed that apparently the Document object
> (writer.getDocument()) provides only two methods to retrieve elements:
>  Element        find(String path)                       [Finds an element
> based on a path of element names.]
>  Element        getElementById(String id)               [Tries to find an
> element in this document whose id is specified.]
>
> and both of them assume that you know precisely what you are looking for,
> and they cannot use of regexp or similar to specify the id and path params.
>
> BTW (maybe OT)
> Can you render a component inside a page or another component that has no
> template at all?
>
> Something like this.
> Container Component Class{
>
> private ContainedComponent myComponent;
>
> @BeginRender
> public void render(MarkupWriter markupWriter){
>        markupWriter.render( myComponent );
> }
> }
>
> I tried adding the @Component annotation and returning the object in the
> different rendering methods, but it didn't work.
>
> Thanks again.
> -- Alessio
>
>



-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to