i tried implementing what you had put and i am stuck because "loggedin" and
"form" are both in the highest scope of the websitem but in the java code,
you have the "form" added to the "loggedin" WeMarkupContainer. that doesnt
seem to fly with wicket unless i'm doing something wrong. i tried to take
out the html for the login form, but that just doesnt make sense because
there will be no corresponding html to describe what should be in the
webcontainer.

this is my code snippet. thanks in advance.

   /*
        * loggedOut - username and password
        */
       WebMarkupContainer loggedOut = new WebMarkupContainer("loggedOut") {
           public boolean isVisible() {
               return ((CSSession) getSession()).getUser() == null;
           }
       };
       TextField userIdField = new TextField("userId",
               new PropertyModel(this, "userId"));
       PasswordTextField passField = new PasswordTextField("password",
               new PropertyModel(this, "password"));
       Form form = new LoginForm("loginForm");

       add(loggedOut);
       loggedOut.add(form);
       form.add(userIdField);
       form.add(passField);

       /*
        * loggedIn - username
        */
       WebMarkupContainer loggedIn = new WebMarkupContainer("loggedIn") {
           public boolean isVisible() {
               return ((CSSession) getSession()).getUser() != null;
           }
       };
       Label userLabel = new Label("userLabel",
           new PropertyModel(this, "userId"));

       add(loggedIn);
       loggedIn.add(userLabel);

...

           <div wicket:id="loggedIn">
               <span wicket:id="userLabel"></span>
           </div>
           <div wicket:id="loggedOut">
           <form wicket:id="loginForm">
               User Name    <input type="text" wicket:id="userId"/><br/>
               Password     <input type="password"
wicket:id="password"/><br/>
               <input type="submit" value="Login"/>
           </form>
           </div>

On 6/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

> <html>
> <body>
> <div wicket:id="loggedin"><span wicket:id="username"></div>
> <div wicket:id="loggedout"><form
> wicket:id="form">...</form></div>
> ...
>
> MyPage() {
>   add(new WebMarkupContainer("loggedin", new
> PropertyModel(this,"session.user.username")) {
>        public boolean isvisible() { return
> ((MySession)getSession()).getUser()!=null; }
>    }
>
>   WebMarkupContainer loggedout=new WebMarkupContainer("loggedout") {
>        public boolean isvisible() { return
> ((MySession)getSession()).getUser()==null; }
>     }
>  add(loggedout);
>  loggedout.add(new Form("form")....


That's the first option. The advantage is that it is generally easier
to see what you have on your page. The other option - like shown in
the templates example - is a bit cheaper memory wise, as you only add
what you need.

Eelco

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to