On Mon, Jan 12, 2009 at 8:15 AM, Steve Viens <st...@viens.net> wrote:

> I'm a newbie too .... but I'm having the same problem without resolution
> (Wicket 1.3.5).  I'd like to simply include the image from the context root.
>  After reading the archive below...
>
> http://www.nabble.com/Newbie-IMG-question-td20501647.html
>
> ...I believe that there isn't supposed to be anthing for me to do.  If I
> want to include the image from the web application's context root I
> shouldn't have to do anything. Anyone else had this happen to them?  Am I
> missing something obvious?
>

For e.g. when you have a mix of pages with bookmarkable URLs - you can't
predict relative paths.  I think best practice is to use ContextImage.
Example usage:

HTML: <img wicket:id="logo"/>
Java: add(new ContextImage("logo", new Model("images/logo.gif")));


>
>
> The Index.html page looks like this
>
> <html>
> <head>
> <title>HelloWicketWorld</title>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <link rel="stylesheet" href="styles/drumbeat.css"/>
> </head>
> <body>
> <img src="images/logo.gif" /><br>
> <span wicket:id="message">Message goes here</span>
> </body>
> </html>
>
>
> The rendered Index.html page looks like this (notice the ../ prefix to the
> image and css files)
>
> <html>
> <head>
> <title>HelloWicketWorld</title>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <link rel="stylesheet" href="../styles/drumbeat.css"/>
> </head>
> <body>
> <img src="../images/logo.gif"/><br>
> <span wicket:id="message">Wicket, Wicket World!</span>
> </body>
> </html>
>
>
> The Index.java default constructor looks like this.
>
> public Index() {
>  add(new Label("message", "Wicket, Wicket World!"));
> }
>
>
> And the web.xml filter mapping looks like this.
>
> <filter>
>  <filter-name>DrumbeatApplication</filter-name>
>  <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>  <init-param>
>    <param-name>applicationClassName</param-name>
>   <param-value>net.viens.drumbeat.markup.DrumbeatApplication</param-value>
>  </init-param>
>  <init-param>
>    <param-name>configuration</param-name>
>    <param-value>development</param-value>
>  </init-param>
> </filter>
>
> <filter-mapping>
>  <filter-name>DrumbeatApplication</filter-name>
>  <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> Steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to