PriorityHeaderItem renders at the beginning of the header
response.render(new PriorityHeaderItem(CssHeaderItem.forReference(CSS)));

François 





Le 17 sept. 2015 à 21:47, Ephraim Rosenfeld <erosenf...@knoa.com> a écrit :

> Hello Team Wicket:
> 
> I have the following situation:
> 
> I have a web application with its own .css files that I add to the markup of 
> my Base page:
> <html>
>    <head>
>         <link rel="sylesheet" type="text/css" href="css/my-styles.css">
>    </head>
> //etc.
> <html>
> 
> I one particular page I am using the Wicket framework to dynamically add .css:
> public class MyTheme extend Behavior {
>                private static final ResourceReference CSS = new 
> CssResourceReference(MyTheme.class, "themes/mytheme.css");
> 
>                @Override
>                public void renderHead(Component component, IHeaderResponse 
> response) {
>                                
> response.render(CssHeaderItem.forReference(CSS));
>                }
> 
> }
> 
> The problem is that this dynamic css is overriding my static .css. When I 
> load the page the dynamic .css is referenced lower down in <head> tag than my 
> static .css <link> tag.
> 
> To get around this issue I would like to use the same  CssHeaderItem 
> functionality to add the .css file from my 'webapp' directory to override the 
> dynamic .css that I am adding via Java.
> 
> How can I reference a .css file within my 'webapp' directory to add it 
> dynamically via Java to my page?
> 
> Thank you in advance,
> 
> - Ephraim
> 

Reply via email to