I wish it as that easy. :p I did add in the super.renderHead(response); call (and I already had it set in child classes).
But still my styles are not showing up. The other weird thing is that if I shutdown my app, re-create the artifacts and basically redeploy; the first time I open my 'HomePage' I see all my styles again, but after doing a page refresh, all styles are removed again and the following WARNING shows: WARN - ResourceReferenceRegistry - Asked to auto-create a ResourceReference, but ResourceReferenceRegistry.createDefaultResourceReference() return null. [scope: com.company.web.WebDummy; name: jquery/js/jquery.myjavascript.js; locale: null; style: null; variation: null] Possibly is a caching problem? On 12-06-12 12:24 AM, "Martin Grigorov" <[email protected]> wrote: >Hi, > >On Tue, Jun 12, 2012 at 4:46 AM, Sean Kendall - NASource Imports ><[email protected]> wrote: >> I am not sure if this is something I am missing or a bug in wicket >>(1.5.7) >> (Tomcat 6) >> >> Basically, I am trying to add CSS and JS references to my 'BasePage' >> (extends WebPage) and my references are not loading. >> The actual markup has a link to the JS and CSS files, yet they do not >>link >> to the actual files. >> >> Here is the basic setup of my 'BasePage.class' >> >> <code> >> >> public abstract class BasePage extends WebPage implements >> IHeaderContributor{ > >No need to implement IHeaderContributor. >o.a.w.Component does this for you in 1.5.x. > >> >> protected BasePage() { >> initPage(); >> } >> >> private void initPage() { >> this.setStatelessHint(true); >> //add a bunch of componentsÅ >> Add(some new Component); >> //end of my adding component code >> }//end of initPage >> >> public void renderHead(IHeaderResponse response) { > >I see you do not call: super.renderHead(response). >For the base page it is not really needed but if you skip this call in >the children pages' #renderHead() then the following code wont be >executed and this will lead to the problem you describe. > >> >> response.renderCSSReference(new >>CssResourceReference(WebDummy.class, >> "css/wicketIsAwesome.css"), "screen"); >> response.renderJavaScriptReference(new >> JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js")); >> response.renderJavaScriptReference(new >> JavaScriptResourceReference(WebDummy.class, "js/lightbox.js")); >> response.renderCSSReference(new >>CssResourceReference(WebDummy.class, >> "css/commonCss.css")); >> //add to some page >> if (this instanceof AwesomeWicketPage) { >> response.renderCSSReference(new >> CssResourceReference(WebDummy.class, "css/jqu.jqz.css")); >> response.renderJavaScriptReference(new >> JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js")); >> response.renderJavaScriptReference(new >> JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js")); >> } >> }//end of renderHead >> }//end of class >> </code> >> >> This is my Directory Structure (hopefully this makes sense): >> -src (directory) >> ---main (directory) >> ------java (directory) >> --------com.company (directory) >> -----------com.company.common (directory) >> -------------------------------BasePage.class >> -------------------------------BasePage.html >> -----------com.company.web (directory) >> -------------------------------WebDummy.class >> -------------------------------com.company.web.js (directory) >> -------------------------------------------javascriptRocks.js >> -------------------------------------------lightbox.js >> -------------------------------------------libjs-1.6.js >> -------------------------------------------mylibsJs-core.js >> -------------------------------com.company.web.css (directory) >> -------------------------------------------wicketIsAwesome.css >> -------------------------------------------commonCss.css >> -------------------------------------------jqu.jqz.css >> >> >> Anyone? >> >> >> >> >> >> >> > > > >-- >Martin Grigorov >jWeekend >Training, Consulting, Development >http://jWeekend.com > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
