Should be void onHello() { // ... }
Tapestry has complained that you don't supply a event handler 'hello' which is like onHello. Thanks, DH ----- Original Message ----- From: "Jason Tan" <jtan...@gmail.com> To: "Tapestry users" <users@tapestry.apache.org> Sent: Friday, April 03, 2009 8:48 AM Subject: Re: Component parameters & events > Sorry, should've been more specific -- the URLs that you POST and GET to > from within the javascript will usually have hardcoded URLs. Perhaps it is > broken than I am using event methods on embedded components to act as the > server-side AJAX handler, and maybe each ajax handler should be its own > page. > > Thanks for the tip on printing parameter value vs. debugger, really good to > know. I thought I was going crazy!!! > > Finally, I'm still baffed by the event method on page. If you have a simple > page, Foo.java, with just this: > > void onActionFromHello() > { > log.debug("onActionFromHello"); > } > > Shouldn't you be able to execute that method by going to > http://example.com/foo:hello ? Except what I get is "Request event 'hello' > (on component foo) was not handled; you must provide a matching event > handler method in the component or in one of its containers." > > I am really scratching my head because this jumpstart > page<http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/eventlinks>has > a perfectly working example, and I feel like I've copied it perfectly. > > > Thanks, > Jason > > > On Thu, Apr 2, 2009 at 5:21 PM, Thiago H. de Paula Figueiredo < > thiag...@gmail.com> wrote: > >> Em Thu, 02 Apr 2009 21:03:54 -0300, Jason Tan <jtan...@gmail.com> >> escreveu: >> >> >> Unfortunately, in AJAX scenarios, the URL has to be hard-coded (though I >>> suppose you could write use an EventLink to render the URL as a global >>> variable inline in the TML, but that seems nasty). >>> >> >> Not quite. You can use methods from ComponentResources and some Tapestry >> services to generate links for you. No need to hardcode URLs. >> >> This example is adapted from EventLink: >> >> @Inject >> private ComponentResources resources; >> >> @Override >> protected Link createMethodLink(Object[] contextArray) { >> return resources.createEventLink("yourEventName", contextArray); >> } >> >> >> My original question though, is whether event methods on *pages* are >>> acceptable, >>> >> >> Yes, and we use it all the time. And the difference between pages and >> components in Tapestry 5 is very small: pages have URLs, components have >> parameters, some different lifecycle events. Internally, a page is a >> component. >> >> Also, I think my first and most baffling question wasn't answered, quoted >>> again for reference. More specifcally, are component parameters expected >>> to be bound by the time a an embedded component's setupRender() is called, >>> or are they only bound when beginRender() is called? My debugging >>> investigation indicated the latter, even though the documentation indicates >>> the former. >>> >> >> Try printing the parameter value instead of using the debugger. Tapestry >> modifies your class on-the-fly and fields with Tapestry annotations are not >> normal fields. >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java consultant, developer, and instructor >> http://www.arsmachina.com.br/thiago >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >