images and relative path

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

images and relative path

domnic savio
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>

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
------------------------------------------------------------------------------
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
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: images and relative path

Daniel Dekany
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
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user