Thank you very much for your responses!!! Lance: very very interesting the onEvent mixin from tapestry-stitch! Thiago: I just learned something new. Thank you very much for your time!
Finally what happened was that I needed to add the following to my AppModule.java and Tapestry not intercepting my url: public static void contributeIgnoredPathsFilter(Configuration<String> configuration) { configuration.add("/combo/*"); } 2013/12/10 Thiago H de Paula Figueiredo <thiag...@gmail.com> > On Tue, 10 Dec 2013 19:05:26 -0200, Javier Val Lista <javilan...@gmail.com> > wrote: > > This is what I was trying at first, catching the onchange event of the >> select component by javascritp, and launch an ajax request to the server. >> The >> problem is Tapestry does not recognize the "GET" url... >> > > Tapestry does recognize GET URLs, but not any. > > > Do you know if Tapestry handles url with a different format? >> > > No. It uses HTTP. > > Here's an example, not tested: > > @Inject > private ComponentResources resources; > > @Inject > private RenderSupport renderSupport; // JavaScriptSupport from 5.2 on > > @Inject > private Request request; > > void afterRender() { > // creates an URL for the 'myValueChanged' event > Link link = resources.createEventLink("myValueChanged"); > // write a call to a JavaScript function > renderSupport.addScript("setMyValueChangedUrl('%s');"), > link.toAbsoluteURI()); > } > > // handle the AJAX request. > Object onMyValueChanged() { > String value = request.getParameter("value"); > // do whatever you want with value > String newValue = ...; > JSONObject object = new JSONObject(); > object.put("newValue", newValue); > return object; > } > > In a .js file included in the page and using Prototype.js, but it can be > easily switched to jQuery if you're already using it: > > var myValueChangedUrl = null; > > function setMyValueChangedUrl(url) { > myValueChangedUrl = url; > } > > $('yourSelectId').observe('change', function(event) { > > // adding the value as a query parameter > var url = myValueChangedUrl + '?value=' + > encodeUri($('yourSelectId').getValue()); > > // do AJAX request > new Ajax.Request(url, { > > // process response > onSuccess: function(transport) { > > // transport.responseJSON is the JSONObject > returned in your event handler method > value response = transport.headerJSON; > > // do something with the response > window.alert(response.newValue); > } > }); > }); > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >