Actually, it doesn't replaces the DOM, it is adding elements. Avoiding contributing same stuff multiple times is still something to be solved. The current code just renders head of all components added to ajax target which is definitely not something we want.
-Matej Juergen Donnerstag wrote: > I've seen your initial code (actually the patch only) and it think it > is going in the right direction. A few ago I responded to a similar > question proposing a solution like you now implemented it. As the ajax > header response "replaces" the DOM it might not be a problem for ajax > components but rendering a whole page the more difficult thing was > with header contribution exclusion e.g. multiple MyLabelWithJavascript > components on the page to be rendered just once, markup inheritance > etc. > > Juergen > > On 7/6/06, Johan Compagner <[EMAIL PROTECTED]> wrote: >> that is not a problem >> The output goes to the HtmlHeaderContainer.getResponse() object >> So just make that a BufferedResponse so that you can get the string out of >> it. >> >> johan >> >> >> >> On 7/6/06, Matej Knopp <[EMAIL PROTECTED]> wrote: >>> Is there a reasonable way to render a header contribution of a component >>> to a string? I'm asking, because looking at Component#renderHead, it >>> takes HtmlHeaderContainer as argument. >>> Juergen? >>> >>> -Matej >>> >>> Matej Knopp wrote: >>>> Matej Knopp wrote: >>>>> Adding both javascript and stylesheets seems to work, at least for >>>>> non-inline javascript and css. Still have to test inline stuff. >>>> I tested inline javascript, works well. Inline styles work too, but in >>>> IE you have to use document.createStyleSheet for it to work. >>>> >>>> I tested all this in FF, IE, Opera. >>>> >>>> Not the question remains, how to ensure that on the same page the >>>> contribution will be only once. >>>> >>>> I suggest handling this on server side. >>>> >>>> Say you have component on a page (not visible). You render page (without >>>> the component). Then you render the component (using ajax). The header >>>> contribution will be rendered. After that on every subsequent ajax >>>> component render, the header contribution will not be rendered, until >>>> the whole page is refreshed (re-rendered). >>>> >>>> -Matej >>>> >>>> >>>>> -Matej >>>>> >>>>> Johan Compagner wrote: >>>>>> if you add css or javascript to the head of the page at runtime in a >>>>>> dynamic way >>>>>> is it then seen in the browser?? >>>>>> We should first test that. >>>>>> >>>>>> johan >>>>>> >>>>>> >>>>>> On 7/5/06, * Matej Knopp* <[EMAIL PROTECTED] <mailto: [EMAIL PROTECTED]>> >> wrote: >>>>>> Hi >>>>>> >>>>>> There's a known problem with head contribution of components, that >> are >>>>>> not rendered when the whole page is (are hidden or not even part >> of >>>>>> hierarchy), but are additionally rendered using an AJAX call. >>>>>> >>>>>> The problem is, that while the body of the component is placed in >> the >>>>>> page, the head contribution is ignored. >>>>>> >>>>>> Any ideas on how should we address this issue? >>>>>> >>>>>> First I though that catching css links and javascript references >> from >>>>>> renderHead would be enough. >>>>>> >>>>>> But each component with associated markup can have it's own >>>>>> <wicket:head>, and this is something we also have take into >> account. >>>>>> So what I'm thinking of now is to let component render it's head >> to a >>>>>> buffer - it will probably be a xml snippet with structure like: >>>>>> >>>>>> <link rel="stylesheet" href="..."/> >>>>>> <style type="text/css"> >>>>>> ... >>>>>> </style> >>>>>> <script type="text/javascript" src="..."> >>>>>> <script type="text/javascript"> >>>>>> ... >>>>>> </script> >>>>>> >>>>>> If this snippet is well formed, I think we can send it as a part >> of our >>>>>> ajax response. >>>>>> e.g. >>>>>> >>>>>> <?xml version=" 1.0" encoding="UTF-8"?> >>>>>> <ajax-response> >>>>>> <component id="c1" > >>>>>> <![CDATA[<span id="c1">3</span>]]> >>>>>> </component> >>>>>> <head> >>>>>> <link rel="stylesheet" href="..."/> >>>>>> <style type="text/css"> >>>>>> ... >>>>>> </style> >>>>>> <script type="text/javascript" src="..."> >>>>>> <script type="text/javascript"> >>>>>> ... >>>>>> </script> >>>>>> </head> >>>>>> </ajax-response> >>>>>> >>>>>> >>>>>> The DOM structure of the head part should be quite straightforward >> to >>>>>> parse. The javascript used to add stylesheet and javascript to >> html head >>>>>> does not seem difficult either. >>>>>> >>>>>> Now the problem seems to be deciding, whether to apply the >> contribution, >>>>>> or whether it has already been applied. We don't want to run the >> same >>>>>> javascript twice, etc. >>>>>> >>>>>> How should this be solved? Any ideas? >>>>>> >>>>>> -Matej >>>>>> >>>>>> 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 >> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>>>> _______________________________________________ >>>>>> Wicket-develop mailing list >>>>>> Wicket-develop@lists.sourceforge.net >>>>>> <mailto:Wicket-develop@lists.sourceforge.net> >>>>>> >> https://lists.sourceforge.net/lists/listinfo/wicket-develop >>>>>> >>>>>> >>>>>> >> ------------------------------------------------------------------------ >>>>>> 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 >>>>> 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 >>>> >>>> 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 >>> >>> 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 >> >> 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 >> >> >> > > 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 > 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