Hi Tom.

You can definitely return a block as the result of an AJAX request. If it's
not an AJAX request then you will get an error about not having a result
processor.

Make sure that the zone parameter is set on the link you are using to
initiate the zone update, and that javascript is turned on. You can check
the request for isXHR to make sure tapestry thinks you are doing an ajax
request.

Josh
On Feb 26, 2011 5:52 AM, "Tom van Dijk" <t...@tvandijk.nl> wrote:
> Hello,
>
> I want to do something that should be simple but appears to be complex.
>
> I want to render a Block and return the result. The context is a website
> in which I want to use Javascript to fill a <div>. I don't want to use a
> zone for this. What I did was make a <t:block> in the .tml file. Now what
I
> want to do is send an event to the page, and return the rendered block
> using JSON. A bit like this:
>
> @Inject
> private Block theBlock;
>
> Object onTheEvent() {
> return theBlock;
> }
>
> I figured out that this doesn't work, because BlockImpl is not handled.
> Okay, I have to return a StreamResponse. What I would like is:
>
> @Inject
> private final BlockRenderer renderer;
>
> Object onTheEvent() {
> return new TextStreamResponse("text/html", renderer.render(theBlock));
> }
>
> Obviously the BlockRenderer service does not exist, but I would want it to
> exist. Or something similar.
>
> Who can help me out?
>
> Tom.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

Reply via email to