<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")....
-igor
On 6/12/07, verbal evasion <[EMAIL PROTECTED]> wrote:
thanks for the responses from eelco and mchack. i appreciate it. i guess
part of the problem is i dont understand enough html either :\. it seems
that you have implied you can put anything in a span tag (e.g. a form and
a label). i will look at the template more carefully. i bought the pro
wicket book and went through half of that, so hopefully when i'm done i will
have more advanced questions.
thanks again,
verbal
On 6/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
>
> > is there a way to conditionally show certain content depending on the
> java
> > portion? one example would be that i have a main page. it displays
> some
> > content and more importantly, a login box. i want to say "if they are
> > already logged in, dont show the login box, but instead, show some
> text that
> > says the user is logged in". everything else on the page would be
> different.
> > one way i can do that is of course to create separate pages for it,
> but
> > there will be a lot of html or code duplication. it is theoretically
> > possible to do so by making your class hierarchy a certain way, but it
> didnt
> > seem natural to me. also, having this technique handy will be useful
> in the
> > future.
>
> Basically the two different strategies you have is to either set the
> visibility of components (or override isVisible) appropriately, or
> build up the hierarchy dynamically. As an example of the latter, you
> could have a are in your page you call top bar. When you construct the
> page, you decide whether to add the top bar with the login panel, or
> the top bar without (e.g. to show the panel that displays the logged
> in user's name). The templates example in Wicket examples shows
> something similar.
>
> 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
-------------------------------------------------------------------------
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