[ 
https://issues.apache.org/jira/browse/WICKET-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830683#action_12830683
 ] 

Juergen Donnerstag commented on WICKET-2725:
--------------------------------------------

The exception is not cause by ajax. As you probably know, Wicket collects the 
header contributions from every component on the page (resp incl in a ajax 
response). Of course Wicket needs a position in the page markup where to put 
the header contributions. And that is before the <body> tag in case no <head> 
was found, or before the <\head> tag. In your markup, Wicket will not find 
either - they are at a wrong position in the markup - and thus throws the 
exception.

<wicket:container wicket:id="detailPanel">
    <head>
        <title>Container Page</title>
    </head>
    <body>
    Panel goes here
    </body>
</wicket:container>

Why does the following not work for you? Header contributions from the panel 
and all other childs will still go in the page/ajax response and you can add 
whatever you want.

<head>
  Here goes my page title
</head>
<body>
    <div wicket:id="myPanel"/>
</body>

MyPanel.html
<wicket:head>
  whatever
</wicket:head>
<wicket:panel>
  my panel
</wicket:panel>



> Component fails to write to Head section inside Panel
> -----------------------------------------------------
>
>                 Key: WICKET-2725
>                 URL: https://issues.apache.org/jira/browse/WICKET-2725
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.5
>            Reporter: bernard
>         Attachments: testcase.zip
>
>
> I use panels to enclose <head> and <body> so I can replace content of a page 
> on this level.
> I do this to 
> a) take advantage of the panel replacement feature that lets the URL 
> unchanged (eliminates back button problems)
> b) use different heads, bodies, scripts and styles per panel
> c) make editing panel HTML requiring external scripts as easy as editing page 
> HTML.
> When doing so, AJAX stops working with the following error:
> "You probably forgot to add a <body> or <header> tag to your markup since no 
> Header Container was 
> found but components were found which want to write to the <head> section.
> ... "
> I am really stuck with this because I have already converted quite a few 
> pages to this pattern.
> The panels are not re-usable components. They are really more like pages that 
> are replaced with the objective of having them all opened with the same URL.
> I think that this is a really simple use case and therefore I am thinking 
> that there might be an alternative implementation achieving the same results. 
> However I still think that this implementation should work.

-- 
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