StringBuilder calendarInit = new StringBuilder();
appendMapping(p, calendarInit);
variables.put("calendarInit", calendarInit.toString());
// render initialization script with the variables interpolated
TextTemplate datePickerJs = new PackageTextTemplate(DatePicker.class, "DatePicker.js");
datePickerJs.interpolate(variables);
response.render(OnDomReadyHeaderItem.forScript(datePickerJs.asString()));
// remove previously generated markup (see onRendered) via javascript in
// ajax requests to not render the yui calendar multiple times
AjaxRequestTarget target = component.getRequestCycle().find(AjaxRequestTarget.class);
if (target != null)