Resource not found error when resource is located two folders inside web folder (Netbeans - java web app)
Working on NetBeans 6.8 ... Java web application
Assume the current location/directory is (default) web folder and the file executed is 开发者_如何转开发index.jsp which is in the web folder.I have created a folder named 'a1' inside the web folder and folder 'a2' inside the 'a1' folder.
web --> a1 --> a2
Each folder contains Image.png<a href="Image.png">Image</a> // works when clicked on the link
<a href="/a1/Image.png">Image</a> // works when clicked on the link
<a href="/a1/a2/Image.png">Image</a> // does not work !!!!!!!
Any file which is more than 1 folder deep generates the error 'resource not found'
Why is this happening?Looks like you have some sort of resolution but it doesn't seem to be the optimal approach. Instead of saving image files on the disk, how about streaming it off of the server by storing them in databases. Upon Upload, store the images in database as Blob and serve the images later using a servlet. Please take a look at Apache File Upload
精彩评论