> > Hello, > > I have started using Wicket few weeks ago and I am still unable to find > simple solutions to simple problems ! The problem I am facing now (after > many others !) is to link to a resource at run time. For example, to link to > a css, I am using : > > <link wicket:id="menucss" type="text/css"> > > in the HTML template and > > add(new StyleSheetReference("menucss", getClass(), "menu.css")); > > or > > add(new StyleSheetReference("menucss", new ResourceReference("menu.css"))); > > Although the file menu.css is in the same directory as the page class, I > only get an error message : > > Unable to resolve shared resource [ResourceReference name = menu.css, scope > = class wicket.Application, locale = null, style = null] > > Thanks for any advice !
If you're running Wicket 1.2 (final) or before, you had to register shared resources in advance, using an initializer. If you use the current svn version - which if Martijn makes it will hopefully released later today or within the next few days -, that is fixed in the sense that you don't have to pre-register resources anymore. Btw, the easiest way of adding header references now - at least it's my preferred way - is to use HeaderContributors. I wrote a little bit about it here: http://chillenious.wordpress.com/2006/05/03/wicket-header-contributions-with-behaviors/ but the javadoc should hopefully be enough too. Btw, I wouldn't say this is a 'simple' problem. Wicket is about the only project that has such header contribution support for reusable components. Many other frameworks either have very rudimentary support, or not at all, requiring you to do your includes in the page (thus breaking the whole idea of having encapsulated components). If there are other issues you are struggling with, please post them here (after searching whether other people had a similar post first of course), or visit ##wicket on freenode. > BTW, I am posting this from Nable since my mail was refused by the list > server because I have no posmaster address in my domain. This is not very > practical ! We are just using sourceforge's mailing list facility, which uses the most widely used mailing list management program in the world. Can't do better than that :) Eelco ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicketemail@example.com https://lists.sourceforge.net/lists/listinfo/wicket-user