Images and css under web-inf
1 posts in topic
Flat View  Flat View

Posted By:   David_Peters
Posted On:   Thursday, May 29, 2003 07:38 AM


I would like to keep all of my web resources under web-inf. I have no problem with JSP's, but have problems with images and css files.

Does anyone have examples on how this is done? I have heard that it is difficult.

Thanks. - DP

Re: Images and css under web-inf

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, May 29, 2003 08:30 AM

I don't think you can put anything under WEB-INF, if the client browser needs to explicitly request it (as happens for image tags, and css or js links, in Web pages). Only server-side code, in jsp's or servlets, can access any resources (files) under WEB-INF.

Otherwise, you have to provide a jsp or servlet (quick: what design pattern is this?), and have the client links/tags only refer to the jsp or servlet (e.g. instead of an "img" tag targetting the actual image file, target the URL for this jsp or servlet with a parameter to indicate which image resource is requested). The jsp or servlet goes and gets the requested resource from WEB-INF, on the server side, and then return its contents, in the response to the client. This has to happen individually for each resource (each image or css file).

About | Sitemap | Contact