Oh, right. Best thing you can do here is wrap the user request in a
model: PropertyModel doesn't allow a null model, but a model that
produces null is fine. So this should work:

   public SignInSuccess(String id) {
       super(id);
       IModel m = new AbstractReadOnlyModel() {

         public abstract Object getObject(Component component) {
            return getCustomSession().getUser();
         }
       }
       add(new Label("username", new PropertyModel(m, "firstName")));
       SignOutForm signOut = new SignOutForm("signOutForm");
       add(signOut);
   }

or even:

   public SignInSuccess(String id) {
       super(id);
       add(new Label("username", new PropertyModel(new
PropertyModel("customSession.user"), "firstName")));
       SignOutForm signOut = new SignOutForm("signOutForm");
       add(signOut);
   }


Eelco


On 1/21/07, Landry Soules <[EMAIL PROTECTED]> wrote:
> Sure. But it's a design problem i have here: my signin and signout
> panels share the same place on the same page, and i'm just set them
> visible/invisible when required, so they're created at the same time.
> Yet getCustomSession().setUser(foo) is called after submit on signin...
> How can i make signout panel to instantiate only after signin has been
> successfull ?
>
>
> Eelco Hillenius a écrit :
> > It looks like getCustomSession().getUser() returns null.
> >
> > Eelco
> >
> >
> > On 1/21/07, Landry Soules <[EMAIL PROTECTED]> wrote:
> >
> >> Hello,
> >>
> >> I want to make work a signin component i have included in a page. When a
> >> user signs in, i retrieve the corresponding user record from DB, and put
> >> it a session property.
> >> Then i hide the signin component, and make visible a new panel,
> >> presenting a signout button, and a welcome message : "welcome <username>".
> >> I fail to render it :
> >>
> >>     public SignInSuccess(String id) {
> >>         super(id);
> >>         add(new Label("username", new PropertyModel(getCustomSession()
> >>                 .getUser(), "firstName")));
> >>         SignOutForm signOut = new SignOutForm("signOutForm");
> >>         add(signOut);
> >>
> >>     }
> >>
> >> It gives me the following error :
> >>
> >> java.lang.IllegalArgumentException: Parameter modelObject cannot be null
> >>
> >>
> >> What did i miss ?
> >>
> >> Thanks for your help
> >>
> >> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share 
> >> your
> >> opinions on IT & business topics through brief surveys - and earn cash
> >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Wicket-user mailing list
> >> Wicket-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to