You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "bernard (JIRA)" <ji...@apache.org> on 2010/02/07 06:08:28 UTC
[jira] Created: (WICKET-2725) Component fails to write to Head
section inside 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
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.
[jira] Closed: (WICKET-2725) Component fails to write to Head
section inside Panel
Posted by "bernard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
bernard closed WICKET-2725.
---------------------------
Resolution: Invalid
Juergen, thank you very much.
Your suggested solution works for me. This is fantasic!
> 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.
[jira] Commented: (WICKET-2725) Component fails to write to Head
section inside Panel
Posted by "bernard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830690#action_12830690 ]
bernard commented on WICKET-2725:
---------------------------------
Juergen, Thanks very much for your Question/Suggestion.
If I use <wicket:head> <script src="url></script></wicket:head> then in the panel's java I don't know how to append a query string (cache control) to the src attribute because it is in <wicket:head>, outside the panel.
Currently I do this with <script wicket:id ..> in my panel. I change it with AbstractBehavior onComponentTag(Component component, ComponentTag tag) ...IRequestCodingStrategy coder = RequestCycle.get()
.getProcessor()
.getRequestCodingStrategy();
valueMap.put(attrName, coder.rewriteStaticRelativeUrl( ...
With this solution Wicket provides me with very good separation of concerns. As you can see, the Java code does not need to know anything about the script tag except it has to modify an attribute for a tag with a wicket:id, and at the same time HTML authors can use the panel as is, as a page in the same way as with <wicket:head>.
So if I follow your suggestion, which looks appealing, then how can I add a string e.g. ?cacheversion=3 to a script src, from inside the panel code, with that number 3 coming from the database?
Preferably this script tag with relative URL is active in static markup without duplication in java code.
> 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.
[jira] Updated: (WICKET-2725) Component fails to write to Head
section inside Panel
Posted by "bernard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
bernard updated WICKET-2725:
----------------------------
Attachment: testcase.zip
Testcase, NetBeans project in zip file
> 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.
[jira] Commented: (WICKET-2725) Component fails to write to Head
section inside Panel
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (WICKET-2725) Component fails to write to Head
section inside Panel
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830702#action_12830702 ]
Juergen Donnerstag commented on WICKET-2725:
--------------------------------------------
you may add components to the header the same way you add them to a page/panel.
<wicket:head>
<script wicket:id="myWhatever" ..>
</wicket:head>
add(new XYZ("myWhatever"))
> 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.