how can i have access to my files that placed in WEB-INF folder

半腔热情 提交于 2019-12-02 04:45:55

From the way you include style.css, I guess your index.jsp is outside the WEB-INF folder which can be accessed directly by client browser. The reason the included style.css works fine is because it is included on the server-side. But in the style.css, to get the background image, the browser will launch a new connect to the image which happens to be inside the WEB-INF folder and the server refuse to send it back and you are doomed.

If you have a centralized controller servlet, you can put your jsps inside the WEB-INF folder to prevent it from accessed directly. Your servlet will redirect all request to appropriate jsp according to request parameters.

As far as I can tell, there is no absolute reason to put images, JavaScripts etc inside this folder, you will definitely run into problems when the browser need to access this folder to retrieve data.

That is not possible. If you want content directly accessible from a browser it can not reside inside WEB-INF.

Why you create theme, js, css in WEB-INF Folder? WEB-INF directory contains metadata about the application. During normal operations, you should not need to modify anything under the WEB-INF directory.

you can create theme, js, css folder under war or WebContent directory directly it will easy to use in your jsp pages.

this link will help you.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!