by default components will not do anything special in the new onattach. the new onatach/detach will also not allow any changes to the hierarchy.
the usecases are such that the component needs to be "initialized" before wicket works with it. for example it can be a hook used to reinject dependencies that are used in onsubmit, etc. -igor On 4/14/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
Why would you want to attach entire page on form submit?! I don't get it. What if there is a listview somewhere? I don't think it's right to attach entire page. If you need some component above form to be attached, just call attach() on it. -Matej On 4/14/07, Johan Compagner <[EMAIL PROTECTED]> wrote: > Hi, > > see this issue: https://issues.apache.org/jira/browse/WICKET-4 > some comment i make there: > > yes onAttach() and onBeforeRender is now purely for the render phase (those > 2 methods are pretty much the same thing) > > onDetach() is called always so that models and components are detached > correctly. > And detach() must be called even if (the current) attach is not called > because of that. > > So when you submit a form and then respond/render to another page > the onAttach is not called for that page with that form. But detach is.. > > I think this is wrong and i already have said i think on the user list how > it should be: (last night i really needed that onattach anyway that i now > have found through IPageEntry...) > > > on submit request comes in respond to same page: > > Page.onAttach(); > form.onSubmit(); > Page.onBeginRender(); > Page.render(); > Page.onEndRender(); > Page.onDetach(); > > > on submit request comes in respond to another page: > > Page1.onAttach(); > form.onSubmit(); > Page2.onAttach(); > Page2.onBeginRender(); > Page2.render(); > Page2.onEndRender(); > Page2.onDetach(); > Page.1onDetach(); > > The problem is that this really breaks onAttach behavior.. > because what is not onattach is then onbeforerender. > For example ListView builds up its new items in onattach that should be done > then in onbefore render. > But we have a much nicer and better contract then when is what and we have a > callback method > when a page is used by wicket (when it comes out of the pagemap or when it > is set/used as a response page) > > what do you guys think? > > johan >
