Thanks for the post. 

I'd probably have to do an anonymous subclass of my Login panel.  It doesn't
know about it's parent or what the parent might like to swap in when a
logged in user is present.

I'll look under the covers of replaceWith() - I basically want to do
whatever replaceWith() does without actually replacing anything.

-Doug


Carl-Eric Menzel-5 wrote:
> 
>> Both Login and CurrentProfile are subclasses of "Panel".  When the 
>> login form is submitted or the logout link is submitted, in order to 
>> get the page to re-render, I had to use this code:
>> 
>> setResponsePage(getPage().getClass());
> 
> In this case the page isn't re-rendered, it is re-created, i.e. a new
> instance of your page class is instantiated, which then does the add(new
> CurrentProfile()) in its constructor.
> 
> In the default behavior you're getting the exact same page instance you
> initially created and in which you said add(new Login()).
> 
> To replace the login panel with the profile panel, keep a reference to
> the login panel and in your form submit method do this:
> 
> login.replaceWith(new CurrentProfile())
> 
> This removes the login panel from the page and, as the method name
> suggests, replaces it with the CurrentProfile instance. Remember the
> latter in a field too, if you ever want to switch back.
> 
> This way you only have one page and swap out its components instead of
> creating new page instances.
> 
> 
> Hope this helps
> Carl-Eric
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/clarification-on-page-versioning-tp16783638p16784204.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to