Use fragments for that instead to switch between the two. So you have
a UserRegistrationPanel that provides this functionality. On the panel
you create 2 fragments: one for just the label, another for the label
and link. Now you can do in onbeforerender:

if(loggedIn)
addOrReplace(new WelcomeFragment());
else addOrReplace(new HaveToSigninFragment());


Martijn

On 3/10/08, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I'd need some help on getting the following to work properly:
>
>  If the user is logged in, display some text "Hello {name}". If he
>  isn't logged in, display a text "Please register or login" instead,
>  where "register" is a link to the register page. If he clicks that
>  link and submits the register form, go back to the former page - use
>  the register page as an intercept page.
>
>  To start with, I don't know how to embed a link inside the label only
>  if the user is logged in - how should I structure the markup for that?
>  A Label component discards its body, so just nesting the link doesn't
>  work.
>
>  The other problem is that redirectToInterceptPage does the redirect,
>  but if I submit the register form I get a MarkupException about a
>  missing component. It looks like the intercept mechanism redirects
>  back to the original page, but loads the wrong template, here the
>  register-page-template. I've got no idea how to get that to work, so
>  far I replaced the intercept with a normal setResponsePage, which is
>  far from optimal.
>
>  Thanks
>  Jörn Zaefferer
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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

Reply via email to