Well, let's think about this for a minute. If the browser can't get at your images and css, how is it supposed to use them on the web page. And since the web server is mapped to ensure anything with a .jsp extension is processed before returning it to the browser, there's no way to get to that source either. Seems like that might be a bit of overkill to me. But if you must, you will have to write a servlet that accepts all requests for *.gif, *.js, *.jpg, *.jpeg, *.css... and retrieves the files from the WEB-INF directory and writes them to the output stream (incidentally, exactly what the servlet container does for anything outside the WEB-INF directory). (*Chris*)
On 11/9/06, robin bajaj <[EMAIL PROTECTED]> wrote:
Hi Everybody, - SUMMARY - Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css ?? - DETAILS - I have SSL enabled my web-app this morning using SSLext release 0 . I am using Struts 1.2.x with Tiles. Now I can switch from http to https etc. So,everything is working fine except that my jsp pages (and other images, css and javascript files) are still lying under WebRoot\ folder. To be specific - webRoot\jsp , webRoot\css, webRoot\images, webRoot\scripts have the corresponding resources. I want to avoid direct access to the jsp (and the static resources) from the browser (foreg: since my jsp pages are currently in webRoot\jsp, user can still access them using http://hostname:port//context-name/jsp/abc.jsp ) So I tried moving my jsp folder (and images, css, scripts folders) to webRoot\WEB-INF\ from webRoot. Since I am using tiles, I also updated the references to the jsps from /jsp/abc.jsp to ---> /WEB-INF/jsp/abc.jsp Now when i go to my home page. My images, javascripts and css are not being applied to the jsp pages. I get plain white jsp page with contents. Just to make sure, that Tiles is not messing things up. I created a new JSP page - Web-inf\jsp\non-tiles.jsp And copied the contents of another jsp that uses javascript and css stylesheets. And forwarded my index.jsp to an actionForward that points to this non-tiles.jsp. Even this .jsp shows up without applying the css and javascript. So I thought its a path issue. I am accessing my javascript and css as <script src="../scripts/oBCTS_scripts.js" language="javascript" type="text/javascript"></script> <link rel=stylesheet type="text/CSS" HREF="../css/styles.css"> Since my non-tiles.jsp is in Web-inf/jsp/ folder , and oBCTS.js file is in Web-inf/scripts/ folder (similary .css file is in Web-inf/css/styles.css) I think the above paths should resolve correctly. But they DO NOT and hence even my non-tiles.jsp shows up without applying the .css stylesheet and .js javascript effects. Just to prove it for myself, I copy-pasted the contents .css and .js files into the jsp itself and now access them as <script type="text/javascript"> [...] </script> <style type="text/css"> [...] </style> So this works fine. (After all... :-( Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css ?? Thanks in advance, robin --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]