Hello, I would like for the script included using a HeaderContributor to be 
above <script> references within the WebPage component head node.  Is this 
possible.  The reason I would like to do this is because I would like to be 
able to reference code from the script file which is included using the 
HeaderContributor.  For example:

--- Application class ---
// inside init method
        addComponentInstantiationListener(new IComponentInstantiationListener() 
{
            public void onInstantiation(Component component) {
                  if (component instanceof WebPage) {
                        component.add(new HeaderContributor(new 
IHeaderContributor() {
                              public void renderHead(IHeaderResponse response) {
                                    response.renderJavascriptReference(new 
JavascriptResourceReference(MyReferenceClass.class, "scripts/example.js"));
                              }
                        }));
                  }
            }
        });

// WebPage component template
<head>
      <script type="text/javascript">
            ...
            // I can't reference anything from the scripts/example.js because 
the source reference appears below this in the rendered output
</script>
</head>

By the way, please tell me if this is bad code and there is a better way as I 
am very new to Wicket.  All code criticism is welcomed :)

Thanks.

Joe

Reply via email to