> and that's bad because users shouldn't be able to get to WEB-INF directly
> should they?

It's not that they shouldn't, it's that the servlet container won't directlty serve 
pages that are
under web-inf.
Ted recommended to put your jsp under web-inf only if they are diplayed through an 
Action. That way,
the only things the user gets to see are actions; They can't bookmark jsps, which 
gives you more
flexibility to rename/reorganize them.

--Vincent


>
> Rob Breeds
>
>
>                     Rob
>                     Breeds/UK/IBM@       To:     [EMAIL PROTECTED]
>                     IBMGB                cc:
>                                          Subject:     how to refer to images from 
>JSPs in WEB-INF?
>                     19/10/2001
>                     10:40
>                     Please respond
>                     to struts-user
>
>
>
> The Struts example (or I read it somewhere on the husted.com pages)
> recommends putting JSPs under the WEB-INF folder so the JSPs can't be
> served directly - only by action path. This seems a good thing but I can't
> get it to work satisfactorily. And no examples I've found ever put the JSPs
> under WEB-INF!
>
> The problem this creates (for me) is that if I want to include an image in
> a JSP, and that image is above the WEB-INF directory, how do I refer to it?
>
> Do I use relative links: <IMG SRC="../theimage.gif>  ? This works but will
> be a pain to maintain.
>
> I can't use an absolute URL because the JSP doesn't know the web app
> context base path and hardcoding the base path would be nasty.
>
> I can't use the <html:base> generated base because that is within the
> WEB-INF directory
>
> I can't put images under WEB-INF  because that will reveal the real action
> path. e.g. http://host/myapp/WEB-INF/images/theimage.gif and will not show
> the image (can't serve from WEB-INF)
>
> Can anyone help please?
>
> Thanks
>
> Rob Breeds

Reply via email to