Hi, I've just committed what I consider to be an "usable AJAX header contribution code".
It means that it can contribute certain elements from AJAX response to header with proper handling of already contributed elements. Supported elements are: - script references <script src="... - inline scripts <script>...</script> - stylesheet references <link href="... - inline stylesheets <style>...</style> Actual contribution is done using javascript by creating relevant DOM representation of elements. Tested with FF1.5, IE6, Opera 8.5 and 9, Konqueror. The only thing user has to take care of to prevent duplicated contribution of element, is to make sure that every *inline* element that has been contributed using *renderHead()* has an unique id. (see AbstractDefaultAjaxBehavior#onRenderHeadInitContribution for example). I tried to touch as little API as possible and I think that it should be possible to backport this to 1.2 without any API break. ------------------------------------------------------------------------ Detecting whether a contribution has already been done: The detection is done using javascript, but there are also some checks on the server side (but they are not perfect, they are just supposed to reduce bandwidth). For script and link references, existing header elements are checked for presence of element of same type with same src/href attribute. For inline elements, document is checked for presence of element with same id. To make sure, that every inline element has proper ID, HeadForceTagIdHandler markup filter has been added. Purpose of this filter is to generate unique id for every inline script and style element between <wicket:head>..</wicket:head> tags. ----------------------------------------------------------------------- I'd appreciate if anyone could test this on some "real" components, to see if there are any issues to be taken care of. -Matej Btw. There is an issue with DatePicker from wicket-contrib. Init code of datepickers is called on every render of datepicker, which causes problems with ajax update (some weird recursion problem). Next issue is that konqueror tries to call initialization code, before the actual referenced javascript is loaded. I guess both of this issues could be solved by deferring datepicker initialization. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop