You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andreas Petersson <an...@petersson.at> on 2009/02/07 01:45:02 UTC
path to resource ../ attached at the beginning
hi!
in the .html file i have references to images such as
<img src="../res/myimage.jpg" width="120" height="90"/>
in the preview this is the correct path.
as soon as i startup the apllication wicket writes out the image as
<img src="../../res/myimage.jpg" width="120" alt="some Image" height="90"/>
1) why is ../ appended at the beginning?
2) how can i replace the path with something like
<link rel="stylesheet" type="text/css" href="resources/my.package.wicket.start.Start/$up$/res/main.css"/>
the css is included via the Start.java with
add(new StyleSheetReference("mainCss", new CompressedResourceReference(Start.class,"../res/main.css")));
since the pictures are added in the classpath, they must be accessed via /resources/
it would be optimal if i can acieve this just by editing the html file, to keep the previewability.
i hate to have duplicate references to the same resource. (java +html that both contain links to the same images...)
best regards
andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: path to resource ../ attached at the beginning
Posted by Erik van Oosten <e....@grons.nl>.
1) Wicket will make all URLs relative.
2) In the markup file use the <wicket:link> element:
MyPanel.html
<wicket:link>
<img src="res/myimage.jps" />
</wicket:link>
The image is resolved starting from the package of MyPanel.class. Note:
wicket:link does not support "..". In this case you would need to create
a sub-package called res and put the image there.
Previewability is maintained this way.
Regards,
Erik.
Andreas Petersson wrote:
> hi!
> in the .html file i have references to images such as
>
> <img src="../res/myimage.jpg" width="120" height="90"/>
> in the preview this is the correct path.
> as soon as i startup the apllication wicket writes out the image as
>
> <img src="../../res/myimage.jpg" width="120" alt="some Image"
> height="90"/>
> 1) why is ../ appended at the beginning?
> 2) how can i replace the path with something like
> <link rel="stylesheet" type="text/css"
> href="resources/my.package.wicket.start.Start/$up$/res/main.css"/>
> the css is included via the Start.java with add(new
> StyleSheetReference("mainCss", new
> CompressedResourceReference(Start.class,"../res/main.css")));
> since the pictures are added in the classpath, they must be accessed
> via /resources/
> it would be optimal if i can acieve this just by editing the html
> file, to keep the previewability.
> i hate to have duplicate references to the same resource. (java +html
> that both contain links to the same images...)
>
> best regards
> andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org