Re: images and relative path

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Saturday, December 8, 2012, 9:47:20 PM, domnic savio wrote:

> Hi there,
> I am trying to display a logo image on the page that is generated.
> I am doing a simple app using java servlets.
>
> I have my ftl und WEB-INF.
> my Images are under WEB-INF/images/logo.png
>
> my web.xml has
>  <init-param>
>             <param-name>TemplatePath</param-name>
>             <param-value>/WEB-INF</param-value>
>         </init-param>
>
> and in im ftl.. I have something like
> <div class="container_12">
>   <h2>
> <image src="/images/thumb.png"/> Pandora's Box </h2>

The WEB-INF folder is not visitable for security reasons; that's the
main point of its existence. Even if it was, you had to write
src="/WEB-INF/images/logo.png". So move the "images" directory one
level higher. See the Servlet specs for more info.

Also, "/images" won't work if the context path (again, see in the
Servlet specs) is not just "/" but something like "/mywebapp".

But all this has nothing to do with FreeMarker really. These are
Servlet questions.

> I am not able to get my image on the rendered html. Can someone
> point me where I am making a mistake.. would be highly appreciated 
> thanks
> Domnic

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.