Re: T5: RenderSupport in XHR requests
If you have a form in the block that is being rendered then I've used the PREPARE_FOR_RENDER event from the form to inject scripts. Subcomponents get their render methods called during a partial render, I'm not sure why the targeted component's render methods are not called. On Tue, Sep 2, 2008 at 12:26 PM, Chris Lewis <[EMAIL PROTECTED]>wrote: > Thanks Howard. Is the availability of RenderSupport within component > event handlers a candidate for a new feature? Without such support I'm > not sure how an app can return JS code to be executed to the client as > the result of an action (ie a fired component event). > > chris > > Howard Lewis Ship wrote: > > It may not work from an event handler method, as its wired into place > > for the partial page render. > > > > On Tue, Sep 2, 2008 at 7:41 AM, Chris Lewis <[EMAIL PROTECTED]> > wrote: > > > >> Hello, > >> > >> I was under the impression that the use of RenderSupport to add > >> javascript to an AJAX response was supported, and that scripts added in > >> such a context via addScript would be executed automatically via > >> tapestry.js when the response is received. Isn't that how it should > work? > >> > >> I'm using a form with a zone to implement a "send link to friend" > >> feature over ajax, but when I try to add js to execute when the ajax > >> reponse completes, a ComponentEventException is thrown saying: > >> > >> No object of type org.apache.tapestry5.RenderSupport is available from > >> the Environment. Available types are > >> org.apache.tapestry5.ValidationTracker, > >> org.apache.tapestry5.services.ComponentEventResultProcessor, > >> org.apache.tapestry5.services.FormSupport, > >> org.apache.tapestry5.services.Heartbeat. [at context:blog/View.tml, line > >> 51, column 73] > >> > >> I've verified in the TapestryModule#contributePartialMarkupRenderer > >> method, line 1647, that a service named "RenderSupport" is being being > >> added to the pipeline, which suggests that it should be available for > >> injection. > >> > >> The page that's using (or want to use) it in an ajax response explicitly > >> checks request.isXHR(), and then adds script code via > >> renderSupport.addScript("");. Have I missed something? > >> > >> Thanks in advance, > >> chris > >> > >> -- > >> http://thegodcode.net > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > > > > > -- > http://thegodcode.net > > -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.
Re: T5: RenderSupport in XHR requests
It would be tricky for some technical reasons. You can return a new Renderable object that will act as a callback from inside the partial rendering pipeline; inside the render() method, the environment (including RenderSupport) will be properly setup: i.e. Object onActionFromFoo() { return new Renderable() { public void render(MarkupWriter writer) { renderSupport.addScript( . . . ); } }; } On Tue, Sep 2, 2008 at 12:26 PM, Chris Lewis <[EMAIL PROTECTED]> wrote: > Thanks Howard. Is the availability of RenderSupport within component > event handlers a candidate for a new feature? Without such support I'm > not sure how an app can return JS code to be executed to the client as > the result of an action (ie a fired component event). > > chris > > Howard Lewis Ship wrote: >> It may not work from an event handler method, as its wired into place >> for the partial page render. >> >> On Tue, Sep 2, 2008 at 7:41 AM, Chris Lewis <[EMAIL PROTECTED]> wrote: >> >>> Hello, >>> >>> I was under the impression that the use of RenderSupport to add >>> javascript to an AJAX response was supported, and that scripts added in >>> such a context via addScript would be executed automatically via >>> tapestry.js when the response is received. Isn't that how it should work? >>> >>> I'm using a form with a zone to implement a "send link to friend" >>> feature over ajax, but when I try to add js to execute when the ajax >>> reponse completes, a ComponentEventException is thrown saying: >>> >>> No object of type org.apache.tapestry5.RenderSupport is available from >>> the Environment. Available types are >>> org.apache.tapestry5.ValidationTracker, >>> org.apache.tapestry5.services.ComponentEventResultProcessor, >>> org.apache.tapestry5.services.FormSupport, >>> org.apache.tapestry5.services.Heartbeat. [at context:blog/View.tml, line >>> 51, column 73] >>> >>> I've verified in the TapestryModule#contributePartialMarkupRenderer >>> method, line 1647, that a service named "RenderSupport" is being being >>> added to the pipeline, which suggests that it should be available for >>> injection. >>> >>> The page that's using (or want to use) it in an ajax response explicitly >>> checks request.isXHR(), and then adds script code via >>> renderSupport.addScript("");. Have I missed something? >>> >>> Thanks in advance, >>> chris >>> >>> -- >>> http://thegodcode.net >>> >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> >> >> > > -- > http://thegodcode.net > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: RenderSupport in XHR requests
Thanks Howard. Is the availability of RenderSupport within component event handlers a candidate for a new feature? Without such support I'm not sure how an app can return JS code to be executed to the client as the result of an action (ie a fired component event). chris Howard Lewis Ship wrote: > It may not work from an event handler method, as its wired into place > for the partial page render. > > On Tue, Sep 2, 2008 at 7:41 AM, Chris Lewis <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> I was under the impression that the use of RenderSupport to add >> javascript to an AJAX response was supported, and that scripts added in >> such a context via addScript would be executed automatically via >> tapestry.js when the response is received. Isn't that how it should work? >> >> I'm using a form with a zone to implement a "send link to friend" >> feature over ajax, but when I try to add js to execute when the ajax >> reponse completes, a ComponentEventException is thrown saying: >> >> No object of type org.apache.tapestry5.RenderSupport is available from >> the Environment. Available types are >> org.apache.tapestry5.ValidationTracker, >> org.apache.tapestry5.services.ComponentEventResultProcessor, >> org.apache.tapestry5.services.FormSupport, >> org.apache.tapestry5.services.Heartbeat. [at context:blog/View.tml, line >> 51, column 73] >> >> I've verified in the TapestryModule#contributePartialMarkupRenderer >> method, line 1647, that a service named "RenderSupport" is being being >> added to the pipeline, which suggests that it should be available for >> injection. >> >> The page that's using (or want to use) it in an ajax response explicitly >> checks request.isXHR(), and then adds script code via >> renderSupport.addScript("");. Have I missed something? >> >> Thanks in advance, >> chris >> >> -- >> http://thegodcode.net >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > > > -- http://thegodcode.net
Re: T5: RenderSupport in XHR requests
It may not work from an event handler method, as its wired into place for the partial page render. On Tue, Sep 2, 2008 at 7:41 AM, Chris Lewis <[EMAIL PROTECTED]> wrote: > Hello, > > I was under the impression that the use of RenderSupport to add > javascript to an AJAX response was supported, and that scripts added in > such a context via addScript would be executed automatically via > tapestry.js when the response is received. Isn't that how it should work? > > I'm using a form with a zone to implement a "send link to friend" > feature over ajax, but when I try to add js to execute when the ajax > reponse completes, a ComponentEventException is thrown saying: > > No object of type org.apache.tapestry5.RenderSupport is available from > the Environment. Available types are > org.apache.tapestry5.ValidationTracker, > org.apache.tapestry5.services.ComponentEventResultProcessor, > org.apache.tapestry5.services.FormSupport, > org.apache.tapestry5.services.Heartbeat. [at context:blog/View.tml, line > 51, column 73] > > I've verified in the TapestryModule#contributePartialMarkupRenderer > method, line 1647, that a service named "RenderSupport" is being being > added to the pipeline, which suggests that it should be available for > injection. > > The page that's using (or want to use) it in an ajax response explicitly > checks request.isXHR(), and then adds script code via > renderSupport.addScript("");. Have I missed something? > > Thanks in advance, > chris > > -- > http://thegodcode.net > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: RenderSupport in XHR requests
Hello, I was under the impression that the use of RenderSupport to add javascript to an AJAX response was supported, and that scripts added in such a context via addScript would be executed automatically via tapestry.js when the response is received. Isn't that how it should work? I'm using a form with a zone to implement a "send link to friend" feature over ajax, but when I try to add js to execute when the ajax reponse completes, a ComponentEventException is thrown saying: No object of type org.apache.tapestry5.RenderSupport is available from the Environment. Available types are org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.services.ComponentEventResultProcessor, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat. [at context:blog/View.tml, line 51, column 73] I've verified in the TapestryModule#contributePartialMarkupRenderer method, line 1647, that a service named "RenderSupport" is being being added to the pipeline, which suggests that it should be available for injection. The page that's using (or want to use) it in an ajax response explicitly checks request.isXHR(), and then adds script code via renderSupport.addScript("");. Have I missed something? Thanks in advance, chris -- http://thegodcode.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]