i did some partial page rendering (PPR) myself ... but i don't
know it is the tapestry 5 way of doing it...
rendering a component from any page....
@Inject
private RequestPageCache _cache;
@Inject
private MarkupWriterFactory mwf;
@Inject
private PageRenderInitializer initializer;
public Object doPPR() {
MarkupWriter markupWriter = mwf.newMarkupWriter();
initializer.setup(markupWriter);
Page page = _cache.get("anypage");
ComponentPageElement element =
page.getRootElement().getEmbeddedElement("anycomponent");
RenderQueueImpl queue =
new RenderQueueImpl(page.getLog());
queue.push(element);
queue.run(markupWriter);
initializer.cleanup(markupWriter);
return new
TextStreamResponse("text/html",markupWriter.toString());
}
"Alexandru Dragomir" <[EMAIL PROTECTED]>
25.05.2007 19:15
Bitte antworten an
"Tapestry users" <[email protected]>
An
"Tapestry users" <[email protected]>
Kopie
Thema
Re: T5 selective rendering
sorry , pressed wrong button:
boolean beginRender() {
return false;
}
And the doc is here :
http://tapestry.apache.org/tapestry5/tapestry-core/guide/rendering.html
On 5/25/07, Alexandru Dragomir <[EMAIL PROTECTED]> wrote:
>
> As simple as it can get :
>
> @Inject
> private ComponentResources resources;
>
> Component setupRender() {
> return resources.getEmbeddedComponent("yourComponent");
> }
>
> boolean beginRender() {
>
> }
>
> On 5/25/07, Janko Muzykant <[EMAIL PROTECTED]> wrote:
> >
> > hi all,
> > is anyone able to give me a hint how could I render only one component
> > from
> > whole the tree of all components that given page consists of? I did
such
> > a
> > thing a few month ago for T4 and it worked exactly like this:
> > * there was a Border component wrapping all the children
> > * there was a special component (let's name it @AjaxContainer)
> > * in case a special id was found in session/request, @Border was
> > replacing
> > current MarkupWriter with NullMarkupWriter and passed the control down
> > to
> > the children.
> > * every component which was not an @AjaxContainer was obviously not
> > rendered
> > in such a case
> > * @AjaxContainer was rendering its contents using original
MarkupWriter.
> >
> > as a result i got only contents of my @AjaxContainer.
> >
> > The question is, how to achieve this functionality in T5? The first
> > problem
> > for me was lack of NullMarkupWriter, secondly I don't know how to pass
> > "replaced" writer to the children components. I guess it may be
achieved
> >
> > somehow easier using MarkupWriterFactory, but how?
> >
> > regards,
> > umrzyk
> >
>
>