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