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