Hi Igor,

I am having problems with loading images. I have the following directory
structure:

-web
--staticpages
----help.html
----image.gif
--scripts
and so on...

I would like to refer to image.gif in help.html under staticpages directory.
Most of the images I want to refer in the HTML files resides in the same
directory.

I used mount(new IndexedParamUrlCodingStrategy("/static",
StaticPage.class)); to mount in Application class and  static/help.html HELP 
to access the help.html page. In StaticPage.java, my basePath is
"/staticpages". So I append my resource, in this case "help.html" to my base
path to get to it.

In help.html, if I use 
image.gif 
staticpages/image.gif 

image does not show up, but if I use

../staticpages/svs_logo_header.gif 
image shows up. It doesn't make sense that I have to go up and down levels
in the directory just to get to the image in the same directory. I am really
confused :( Please help.

Thanks.








igor.vaynberg wrote:
> 
> what happens when you paste the url of the image directly into the
> browser's address bar?
> 
> this wouldnt be wicket finding or rendering the images, they would be
> served directly by the servlet container.
> 
> -igor
> 
> On Tue, Mar 3, 2009 at 7:46 AM, Vika <victoria.elin...@nasa.gov> wrote:
>>
>> I am having the same problem!
>>
>>
>> matrixguy wrote:
>>>
>>> Hi,
>>>
>>> The following code worked very nicely with the text in the HTML file,
>>> but
>>> it's not working with the embedded images in the HTML file. I have
>>> verified that wicket can find the images (so it's not the path issue for
>>> the images). It's as if wicket can find the images but not able to
>>> render
>>> them. :( Any ideas?
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>> igor.vaynberg wrote:
>>>>
>>>> all you have to do is this:
>>>>
>>>> mount(new indexedparamcodingstrategy("/static", StaticPage.class));
>>>>
>>>> class staticpage extends MyBasePageWithDecoratingMarkup {
>>>>   private final String resource;
>>>>   public staticpage(PageParameters params) {
>>>>     resource=params.get("0");
>>>>     add(new Label("content", new PropertyModel(this,
>>>> "content")).setEscapeModelStrings(false));
>>>>   }
>>>>
>>>>   public String getContent() {
>>>>      // load the resource content however you want
>>>>      InputStream is=new FileInputStream(basePath+"/"+resource);
>>>>      try {
>>>>         return Streams.readIntoString(is);
>>>>      } finally { is.close(); }
>>>>   }
>>>> }
>>>>
>>>> static.page.html: [wicket:extend][wicket:container
>>>> wicket:id="content"]content will be
>>>> here[/wicket:container][/wicket:extend]
>>>>
>>>> then if you go to /static/myfile.html the contents of myfile.html will
>>>> be shown within your decorated page
>>>>
>>>> -igor
>>>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-give-static-pages-consistant-look-with-wicket---partial-repeat-tp21958254p22317120.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to