Thank you very much !

It is not yet fully working, but I have no more exception. I used 

    add(new StyleSheetReference("menucss", getClass(),
"stylesheets/menu/menu.css"));

as Frank said and put the menu.css file where it belongs (the above
directory structure starting whe the page class is).

Among the remaining problems, is the fact that references to image files
inside the css don't work, although this images are in the same directory as
the css and I am using references such as 

background-image: url(button.jpg);

I also tried 

background-image: url(/stylesheets/menu/button.jpg);

after placing a copy of the button.jpg file in /stylesheets/menu/. (starting
at the context root, which is by the way something IDEA likes !) It does not
work either although the graphics is accessible in the browser through 

http://localhost:8080/learnwicket/stylesheets/menu/button.jpg

(learnwicket being the context fro the application.)

I am using Wicket 1.2. I did not know about HeaderContributors, but I am
going to read your article asap.

BTW, I have struggled with another problem about loading images dynamically
at run time while having to pass not only the file name but the width,
height and alt attributes. After days of experiments, I ended with this
solution :

    WebMarkupContainer wmc = new WebMarkupContainer("image0");
    wmc.add(new AttributeModifier("src", new
Model("images/vd-contrebasse.png")));
    wmc.add(new AttributeModifier("width", new Model("132")));
    wmc.add(new AttributeModifier("height", new Model("101")));
    wmc.add(new AttributeModifier("alt", new Model("Mains sur une
contrebasse")));
    add(wmc);

Although it works, it looks a bit like brute force ! (This approach also
work for linking to a css file, and I suppose it could work for setting any
attribute of any element, but it looks ugly ! Is there a better way to
achieve this ?

Thanks al lot for your help,

Pierre-Yves


-- 
View this message in context: 
http://www.nabble.com/How-to-programatically-link-to-a-css-or-a-script---tf1988255.html#a5457215
Sent from the Wicket - User forum at Nabble.com.


-------------------------------------------------------------------------
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to