+1 for Thiago's approach -- it is also widely used, especially if you want to render markup or update some zones in response.
On Fri, Aug 16, 2013 at 2:52 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Fri, 16 Aug 2013 06:46:28 -0300, Martin Kersten < > martin.kersten...@gmail.com> wrote: > > I investigated the cometd yesterday and today. The maven repository was >> broken for this one. Since the last commit is half a year old, I think it >> is not maintained anymore. I currently at the moment try to do the same >> but >> using atmosphere instead if this is not working I will try to redo the >> cometd implementation myself. >> >> Are their other (more tapestry like) ways to talk to your js components >> directly? >> > > 1) Create a Link (which is basically an URL) for your own event by > @Inject'ing ComponentResources and using its createEventLink() method. > Let's suppose your event name is XXX, so componentResources.** > createEventLink("XXX"); > > 2) Create an event handler for it: JSONObject onXXX() {...}. The return > value will depend on what you want to be done after the event was handled. > JSONObject is a Java representation of a JavaScript object in JSON > notation. @Inject Request and request.getParameter("name") for getting > query parameters. > > 3) Pass the link created in step 2 to your JavaScript code. The easier way > is @Inject'ing JavaScriptSupport and using its addScript() method, which > can be invoked, for example, in an afterRender() method (beforeRender() or > setupRender() also works). > > 4) In your JavaScript code, use the link (URL) above as the target of an > AJAX request and pass any information you need as query parameters. > > -- > Thiago H. de Paula Figueiredo > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Dmitry Gusev AnjLab Team http://anjlab.com