Hi,
My setup is a bit longer:
// this is the id of the HeaderResponseContainer in the end of the <body>
String JsInFooterFilterName = "jsInFooter";
setHeaderResponseDecorator(new IHeaderResponseDecorator {
public IHeaderResponse decorate(IHeaderResponse response) {
String headBucket = "headBucket";
List<FilteringHeaderResponse.IHeaderResponseFilter> filters = new
ArrayList<FilteringHeaderResponse.IHeaderResponseFilter>();
AbstractHeaderResponseFilter jsAcceptingFilter = new
AbstractHeaderResponseFilter(JsInFooterFilterName) {
public boolean accepts(HeaderItem item) {
return item instanceof JavaScriptHeaderItem ||
item instanceof OnDomReadyHeaderItem ||
item instanceof OnLoadHeaderItem;
}
}
filters.add(jsAcceptingFilter);
OppositeHeaderResponseFilter nonJsFilter = new
OppositeHeaderResponseFilter(headBucket, jsAcceptingFilter);
filters.add(nonJsFilter);
return new FilteringHeaderResponse(response, headBucket, filters);
}
});
On Tue, Nov 13, 2012 at 10:43 PM, jlangston <[email protected]> wrote:
> Testing our application with wicket 6.0.0 it works that the event block is
> in
> the footer bucket but with wicket 6.2.0 it gets rendered in the head. I was
> able to see the same behavior using a quickstart on wicket 6.2.0.
>
> In the init method of WicketApplication I set the response decorator.
>
> setHeaderResponseDecorator(new IHeaderResponseDecorator()
> {
> @Override
> public IHeaderResponse decorate(IHeaderResponse response)
> {
> return new JavaScriptFilteredIntoFooterHeaderResponse(response,
> "footerJS");
> }
> });
>
> The Homepage class I simply set the footer bucket container and add an ajax
> link so it will add the event script tag and wicket event js reference.
>
> public class HomePage extends WebPage
> {
> private static final long serialVersionUID = 1L;
>
> public HomePage(final PageParameters parameters)
> {
> super(parameters);
> add(new AjaxLink<Void>("alertTrigger")
> {
> private static final long serialVersionUID = -3848680946743570021L;
>
> @Override
> public void onClick(AjaxRequestTarget arg0)
> {
> arg0
> .appendJavaScript("alert('View source and see the Event Script
> tag
> is in the header when it should get put in the footer')");
> }
> });
> add(new HeaderResponseContainer("footerJs", "footerJS"));
> }
> }
>
> In the html file
> Ajax Link
> <wicket:container wicket:id="footerJs"/>
>
>
> With this quickstart the jquery library reference, wicket-event.js and the
> script block for the events are put in the header tag when all the other
> JS
> is correctly put into the footer bucket.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-6-event-script-tag-and-JavaScriptFilteredIntoFooterHeaderResponse-tp4653800p4653850.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>