final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
if (target == null) {
response.render(JavaScriptHeaderItem.forScript(buf, "datepicker"));
response.render(JavaScriptHeaderItem.forScript(getDatePickerInitJavaScript(id, autosubmit), null));
} else {
target.appendJavaScript(buf);
target.appendJavaScript(getDatePickerInitJavaScript(id, autosubmit));
}
}
public static String getDatePickerInitJavaScript(final String id, final boolean autosubmit)