OK, I found the problem : I used style.css instead of styles.css.
Now, .css and images folder are in the right place (next to BasePage.html in
the package) and they are in the class path.
Thanks to that configuration, when I tried, I had this warning message :
INFO - haredResourceRequestTarget - shared resource
fr.statlife.protoE4N.BasePageVisiteur/images/content-bg.jpg not found or not
allowed access
and this is why I am in trouble since the beginning : in styles.css, there
was a link to an image that it is not in the images folder. So I remove this
link and try again and now it works :)
Thanks a lot for your help !!
I have a second question : how add a class style to my bookMarkableLink only
when it in use?
I try to add
WebMarkupContainer lienAccueil = new
WebMarkupContainer("accueilpage");
lienAccueil.add(new SimpleAttributeModifier("class",
"selected-item"));
in the AccueilPage constructor, but it doesn't work : the class attribute is
not add to accueilpage markup...
2011/5/20 Martin Grigorov <[email protected]>
> 1. the images in .css should use relative urls to the .css file.
> For beginning put .css and the images in the same folder and reference them
> with url('someImage.png')
>
> 2. Did you move style(s).css in fr/statlife/protoE4N/ folder ?
> If you use Wicket's resources then you should put the .css (and the images)
> next to the component's .class/.html files
>
> Using add(CSSPackageResource.getHeaderContribution(BasePageVisiteur.class,
> "style.css"));
> means that style.css should be next to BasePageVisiteur.class in the
> classpath. Ensure your IDE copies the .css (and images) in the build path.
>
> On Fri, May 20, 2011 at 12:44 PM, Mathilde Pellerin <
> [email protected]> wrote:
>
> > OK, I tried "/style.css" but it didn't work : style is apply but error
> page
> > is called (maybe for images used in style.css?)
> >
> > So, I try to implement the other solution.
> > I found example on the wiki (
> > https://cwiki.apache.org/WICKET/including-css-resources.html). I try
> with
> > <wicket:head>
> > <wicket:link>
> > <link rel="stylesheet" type="text/css" href="style.css"/>
> > </wicket:link>
> > </wicket:head>
> > on basePage.html, but style is not apply and error page still called.
> >
> > so I try the other solution : I remove <wicket:head> block and I add
> >
> >
> add(CSSPackageResource.getHeaderContribution(BasePageVisiteur.class,
> > "style.css"));
> >
> > in BasePage.java constructor, but style is not apply, error page still
> > called, and there is this warning message in Eclipse console :
> > WARN - PackageResource - Unable to find package resource
> [path
> > =
> > fr/statlife/protoE4N/style.css, style = null, locale = null]
> >
> > So I do not the right thing, and I am pretty lost... I'm sorry cause it's
> > certainly very simple to do that. I don't understand what am I doing
> wrong.
> >
> >
> > 2011/5/20 Martin Grigorov <[email protected]>
> >
> > > On Fri, May 20, 2011 at 11:48 AM, Mathilde Pellerin <
> > > [email protected]> wrote:
> > >
> > > > it was in the webapp folder, so I put it in the WEB-INF folder and I
> > put
> > > > images folder in the WEB-INF folder to, put the error page is still
> > > called.
> > > >
> > > > I don't understand what happen cause css styles are visibly there in
> > base
> > > > page and in extends pages.
> > > >
> > > > this is my basePage head :
> > > > <head>
> > > > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> > > > <link rel="stylesheet" href="styles.css" type="text/css" />
> > > > <title>Prototype E4N</title>
> > > > </head>
> > > >
> > > > and my extends pages head:
> > > > <head>
> > > > <title>Prototype E4N</title>
> > > > </head>
> > > >
> > > > Put
> > > > <link rel="stylesheet" href="styles.css" type="text/css" />
> > > >
> > > > in all extends pages head doesn't change anything.
> > > >
> > > > maybe I have to use instead...
> > > > <wicket:link><link .../></wicket:link>
> > > > should these tag be use in all pages or only on basepage?
> > > >
> > > > Only in the base page.
> > > All inherited pages should use <wicket:head> if they want to donate to
> > the
> > > header.
> > > Change the url to href="/styles.css". This way it will work. But this
> is
> > > application specific and depends on the filter path you use in your
> > > web.xml.
> > > If you want to make it independent then you should put the .css file
> next
> > > to
> > > MyPage.html and use Wicket's ResourceReference to put it in the header.
> > >
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
--
Mathilde Pellerin Ingénieur en Génie Logiciel Tél mobile :
06.60.78.79.03 E-mail
: [email protected] Mon CV en ligne :
<http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/ Mes
liens : <http://www.viadeo.com/fr/profile/mathilde.pellerin>
<http://fr.linkedin.com/in/mathildepellerin>