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