[ 
https://issues.apache.org/jira/browse/WICKET-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535381
 ] 

Gerolf Seitz commented on WICKET-1032:
--------------------------------------

the problem is, that the markup is not associated with the form but rather with 
the page.
so instead of 
if ((stream == null) && (getParent() != null))
{
        stream = getParent().getAssociatedMarkupStream();
}

we could do:
steam = getParent().getMarkupStream()

or find the associated markupstream somewhere in the hierarchy above the 
fragment:

MarkupContainer parent = getParent();
while ((stream == null) && (parent != null))
{
        stream = parent.getAssociatedMarkupStream();
        parent = parent.getParent();
}

Matej, wdyt?

> MarkupNotFoundException when fragment is rerendered during AJAX call
> --------------------------------------------------------------------
>
>                 Key: WICKET-1032
>                 URL: https://issues.apache.org/jira/browse/WICKET-1032
>             Project: Wicket
>          Issue Type: Bug
>            Reporter: John Ray
>            Priority: Minor
>             Fix For: 1.3.0-beta5
>
>         Attachments: quickstart.zip
>
>
> I have a Fragment with a TextField inside of it. Everything works fine when 
> the page is first loaded. However inside of an AJAX call I add the TextField 
> to be rendered again and I get a MarkupNotFoundException from the fragment. 
> Apparently because the TextField asks the Fragment for the markup and the 
> fragment can't find it. I tracked the problem down and when I'm constructing 
> the Fragment I pass in a ListItem (that contains the fragment) as the 
> markupProvider. If I pass in the WebPage then everything works fine. 
> I noticed in the Fragment.chooseMarkupStream() there is this section of code 
> that get's called during the initial page rendering.
>       stream = markupProvider.getAssociatedMarkupStream(false);
>       if (stream == null)
>       {
>               // The following statement assumes that the markup provider is a
>               // parent along the line up to the Page
>               stream = markupProvider.getMarkupStream();
>       }
> However during the AJAX call back Fragment.getAssociatedMarkupStream() is 
> called and it only has 
>       if (markupProvider != null)
>       {
>               stream = markupProvider.getAssociatedMarkupStream(false);
>       }
> If I add the "if (stream == null)" section that chooseMarkupStream() has to 
> the above code then AJAX calls work fine even if I pass in a ListItem as the 
> markupProvider to a Fragment. I'm not sure if this is the correct fix as I 
> don't know the wicket code that well. I suppose another fix might be to 
> prohibit passing in components such as ListItems as the markupProvider or at 
> least make the Java Docs a little clearer. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to