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
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to