users@glassfish.java.net

Re: where to place images in application using glassfish

From: Hassan Schroeder <hassan.schroeder_at_gmail.com>
Date: Tue, 22 Sep 2009 08:11:26 -0700

On Tue, Sep 22, 2009 at 7:39 AM, Eve Pokua <gorgeous65_at_msn.com> wrote:

> In tomcat, i would do something like the following:

> if your jsp page is at /ROOT/jsps/mydisply.jsp and images
> are in /ROOT/images I can construct a <display:column> tag:
>
> <display:column>
> <img src="../images/${bpic}"/>
> </display:column>

That should be an absolute path ( drop the leading ".."). And it
really should include the context path, though if this is the ROOT
context it's not essential.

> Now where to I place my images using glassfish.

Exactly the same place as using Tomcat.

> I assum in my web-inf folder of my application
>
> then I can access it as follows:

> <display:column><img border="1" src="/WEB-INF/${bpic}" height="200"
> width="200"  title="Bale Picture"/></display:column>

No, then as you've discovered, no one will be able to see them --
files in WEB-INF are protected from direct access, which a browser
needs in order to fetch them. That's part of the Servlet Spec.

-- 
Hassan Schroeder ------------------------ hassan.schroeder_at_gmail.com
twitter: @hassan