Ah, sorry. I didn't read closely what you were trying to do. For ajax response you need a RenderCommand, as Thiago said...
On Thu, Jul 7, 2011 at 10:02 AM, Mark <mark-li...@xeric.net> wrote: > Josh, > > Thats what I thought originally. This is for a ModalDialog using > Taha's addon. When someone clicks "more info" it pops up with a modal > dialog box and the contents are determined by this method. If I > return a String, Tapestry tries to find a page that matches the String > and return that instead of just rendering it in the modal dialog box. > > Mark > > > > On Thu, Jul 7, 2011 at 11:43 AM, Josh Canfield <joshcanfi...@gmail.com> wrote: >> Have you tried returning a String? There is a built-in TypeCoercer for >> String -> Renderable >> >> This is implemented using StringRenderable which uses write(text) (not >> writeRaw) so your html will be escaped. >> >> Josh >> >> On Thu, Jul 7, 2011 at 9:35 AM, Mark <mark-li...@xeric.net> wrote: >>> On Thu, Jul 7, 2011 at 6:34 AM, Thiago H. de Paula Figueiredo >>> <thiag...@gmail.com> wrote: >>>> On Thu, 07 Jul 2011 01:25:39 -0300, Mark <mark-li...@xeric.net> wrote: >>>> >>>>> Is there a better way to construct a block from a string in Java than >>>>> this? >>>>> >>>>> Block onShowDialogFromMoreInfo(TicketClass ticketClass) { >>>>> return new RenderableAsBlock(new >>>>> StringRenderable(person.getInfo())); >>>>> } >>>> >>>> Do you really need it to be a block? To pass it to Delegate? It doesn't >>>> need >>>> to be a block. It can also be a component or any object that implements >>>> RenderCommand. Why don't you just return a RenderCommand instance? Tapestry >>>> ultimately renders only RenderCommand's. Anything else which can be >>>> rendered >>>> implements RenderCommand (including BlockImpl) or converted to an instance >>>> of it. >>> >>> Ah ok. So something along the lines of this? >>> >>> Object onShowDialogFromMoreInfo(final Person person) { >>> return new RenderCommand() >>> { >>> public void render(MarkupWriter writer, RenderQueue queue) >>> { >>> writer.writeRaw("<b>" + person.getName() + "</b>"); >>> } >>> }; >>> } >>> >>> I was thinking that there should be a way to do it with just a string, >>> but I guess that won't work because a string will try to send the >>> browser to a new page instead of just updating the part that needs to >>> be updated. >>> >>> Mark >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org