Thanks for the speedy response. That all makes sense, and I am aware of the ActionLink and EventLink components, and use them as much as I can. 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). Thus, in http://example.com/foo.bar:hello <http://example.com/foo:hello>, if *bar*acts as a server-side AJAX handler via its event method, I need to make calls directly to onActionFromHello() (which returns a JSONStreamResponse). My original question though, is whether event methods on *pages* are acceptable, or can they only exist in components? As I tried, placing an onActionFromHello() method on the Foo page and hitting http://example.com/foo:hello seemed to complain about not finding a matching event handler method. Likewise, I tried http://example.com/foo.hello<http://example.com/foo:hello>and it complains about no component with id "hello" (as it should).
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. [[[[On the 5.0.18 docs for component rendering<http://tapestry.apache.org/tapestry5/guide/rendering.html>, it clearly states that in setupRender(), "This is a good place to read component parameters and use them to set temporary instance variables.". So I did exactly that. I made a Foo page (with simple tml), with an embedded Bar component (with simple tml) that takes a required parameter called barParam of type String. I bound barParam in Foo's setupRender to "someString". In Bar's *setupRender*(), I set a breakpoint, and voila, barParam is null. Amazingly, I set a breakpoint in *beginRender*(), and barParam is properly set to "someString". Am I missing something???]]]]] I appreciate the help. Thanks, Jason On Thu, Apr 2, 2009 at 4:48 PM, Howard Lewis Ship <hls...@gmail.com> wrote: > On Thu, Apr 2, 2009 at 4:30 PM, Jason Tan <jtan...@gmail.com> wrote: > > I must be going crazy. > > > > Well, you are finding the hard way to do things. > > > On the 5.0.18 docs for component > > rendering<http://tapestry.apache.org/tapestry5/guide/rendering.html>, > > it clearly states that in setupRender(), "This is a good place to read > > component parameters and use them to set temporary instance variables.". > > > > So I did exactly that. I made a Foo page (with simple tml), with an > embedded > > Bar component (with simple tml) that takes a required parameter called > > barParam of type String. I bound barParam in Foo's setupRender to > > "someString". In Bar's *setupRender*(), I set a breakpoint, and voila, > > barParam is null. Amazingly, I set a breakpoint in *beginRender*(), and > > barParam is properly set to "someString". Am I missing something??? > > > > Second question -- if an embedded component handles an event, i.e. > > onActionFromHello, it appears that bound parameters from initial page > render > > are lost on subsequent calls straight to the url, i.e > > http://example.com/foo.bar:hello (as this would happen in AJAX). As I > > understand it, the only way to keep this persistent between subsequent > AJAX > > calls would be using @Persist? > > Think of it this way. Tapestry only knows three things for any request: > 1) The static structure of the page > 2) Values of persistent fields (restored from the session) > 3) Context information encoded into the URL. > > though I suppose > > 4) Data encoded into the form submission > > should also be included. In any case, Tapestry is always working from > this information forward. It's isn't magic, and as you get into the > more complex Ajax scenarios, it becomes more your responsibility (via > activation contexts) to ensure that information you need in a request > is actually available. > > > > > > Third question: event methods can be placed on pages, not just > components, > > right? i.e if on page Foo i want to bind to the event Hello, i just add > > "void onActionFromHello() { //blah blah }" and I should be able to > trigger > > that event by hitting http://example.com/foo:hello , right? That doesnt > seem > > to work, it complains with "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 don't have to do anything else, right? > > Tapestry has APIs to generate component event URLs; the above triggers > a "hello" event on component "foo". The structure of component event > URLs is subject to both change and customization ... use the correct > APIs. > > > > > Thanks, > > Jason > > > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >