Thanks Igor for your patience :) 
Yes this solution is neat. So in this case we are by passing the PageMap concept built into wicket since we are creating the WelcomePage ourselves? So its ok to instantiate pages if the situation demands it ?. But it also means that if my WelcomePage has lots of widgets, the component tree for WelcomePage will be constructed again.
 
On a side note, I'm not too impressed with the wicket documentation on the wiki but user-support is excellent!
 
I shall try to contribute a tutorial for a beginner like me if that is ok.
 
regards,
karthik
 
On 12/21/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
here is how i would do it

class WelcomePage extends WebPage {
  public WelcomePage(long userId) {
     User user=getUser(userId);
     add(new Label("message", "welcome "+user.getName()));
  }
}

so now you have a welcome page that can display the correct message based on the login id you pass into the constructor.

then in your login page:
onsubmit() {
  setResponsePage(new WelcomePage(userId));
}


Maybe you dont even need to pass in the loggedin user id into the welcomepage as a constructor. you have to store that somewhere in the session right? maybe the welcome page can pull it out of session, then all you need to do is setResponsePage(new WelcomePage());

There is a signin example in wicket-examples project that shows this exact scenario.


-Igor




Reply via email to