You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eelco Hillenius <ee...@gmail.com> on 2007/09/17 20:38:37 UTC
Re: findParent(BasePage.class) returns null
That is because you replace a parent in the hierarchy of the component
you ask the page for.
Eelco
On 9/17/07, Maris Orbidans <sm...@ime.lv> wrote:
> Hi
>
> The problem is that findParent(BasePage.class) returns a correct
> reference and after few more lines of code it returns null.
>
> How is that possible ?
>
> I am using 1.3 beta3.
>
> protected void onSubmit(AjaxRequestTarget target, Form form)
> {
> LoginForm loginForm = (LoginForm) form;
> String username = loginForm.getUsername();
> ProjectsSession session = (ProjectsSession) getSession();
> session.setLoggedIn(true);
> session.setUsername(username);
>
> for (int i =0 ; i<3 ; i++)
> {
> log.info("**** :
> "+(findParent(BasePage.class)==null)); // FALSE
> }
>
> MarkupContainer container = findParent(BasePage.class);
>
> container.get("menuPanel").setVisible(true);
> target.addComponent(container.get("menuPanel"));
>
> container.get("contentPanel").replaceWith(new
> ProjectsSearchResultsPanel("contentPanel").setOutputMarkupId(true));
> target.addComponent(container.get("contentPanel"));
>
> if (findParent(BasePage.class)==null) // TRUE
> {
> log.error("ERROR");
> }
>
> log.info("User " + username +" logged in");
> }
>
>
> 21:22:24,703 INFO [LoginPanel] **** : false
> 21:22:24,703 INFO [LoginPanel] **** : false
> 21:22:24,703 INFO [LoginPanel] **** : false
> 21:23:14,359 ERROR [LoginPanel] ERROR
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org