Hi,

I am using Tomcat 7.0.11 and environment is win 7 home premium with servlet/jsp/jstl with netbeans 7.01

I have form where in I upload the image to the folder C://xx using apache commons file upload and then store the file name to the DB.Everything is good till here.

Then when I want to display the same image, I query the database using servlet and store the image name to attribute like

 request.setAttribute("collegesimg", img);

now via front end jsp, I want to display the same image stored in attribute,

I do

<img src="C://UploadedImages/${collegesimg}" width="80%" height="500">

Now this works perfectly fine,but FF/Chrome fails saying cannot load local resources with 404 status.

Now I can understand that this is FF/Chrome by default do allow to access local file system on the client.Good till here.

But I am not able to figure out where do I store the images now so that I can display it correctly and they remain in place when I redeploy the app?Is their any place in Tomcat's dir structure where the folder is still called root folder and when we undeploy or redeploy , images still remains intact ?

My tomcat 7.0.11 structure looks something like below,


C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11>dir
 Volume in drive C is OS
 Volume Serial Number is 8255-4D52

Directory of C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11

06/12/2011  05:17 AM <DIR>          .
06/12/2011  05:17 AM <DIR>          ..
06/12/2011  05:16 AM <DIR>          bin
08/16/2011  09:05 AM <DIR>          conf
12/07/2011  07:25 AM <DIR>          lib
03/10/2011  03:44 PM            57,851 LICENSE
05/29/2012  12:05 AM <DIR>          logs
03/10/2011  03:44 PM             1,230 NOTICE
03/10/2011  03:44 PM             9,011 RELEASE-NOTES
03/10/2011  03:44 PM             6,860 RUNNING.txt
05/29/2012  03:44 AM <DIR>          temp
06/12/2011  05:17 AM         2,221,126 uninstall.exe
03/30/2012  07:40 AM <DIR>          webapps
08/14/2011  08:15 AM <DIR>          work
               5 File(s)      2,296,078 bytes
               9 Dir(s)  245,526,077,440 bytes free

C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11>cd webapps

C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\webapps>dir
 Volume in drive C is OS


Directory of C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\w
ebapps

03/30/2012  07:40 AM <DIR>          .
03/30/2012  07:40 AM <DIR>          ..
06/12/2011  05:16 AM <DIR>          docs
06/12/2011  05:16 AM <DIR>          examples
03/30/2012  07:40 AM <DIR>          files
06/12/2011  05:16 AM <DIR>          host-manager
06/12/2011  05:16 AM <DIR>          manager
06/12/2011  05:16 AM <DIR>          ROOT
               0 File(s)              0 bytes
               8 Dir(s)  245,526,077,440 bytes free

C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\webapps>cd root


C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\webapps\ROOT>di
r
 Volume in drive C is OS
 Volume Serial Number is 8255-4D52

Directory of C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\w
ebapps\ROOT

06/12/2011  05:16 AM <DIR>          .
06/12/2011  05:16 AM <DIR>          ..
03/10/2011  03:44 PM             5,866 asf-logo-wide.gif
03/10/2011  03:44 PM            17,811 asf-logo.png
03/10/2011  03:44 PM               713 bg-button.png
03/10/2011  03:44 PM             1,918 bg-middle.png
03/10/2011  03:44 PM             1,392 bg-nav-item.png
03/10/2011  03:44 PM             1,401 bg-nav.png
03/10/2011  03:44 PM             3,103 bg-upper.png
03/10/2011  03:44 PM             3,469 build.xml
03/10/2011  03:44 PM            21,630 favicon.ico
03/10/2011  03:44 PM            13,066 index.jsp
03/10/2011  03:44 PM             9,011 RELEASE-NOTES.txt
03/10/2011  03:44 PM             2,376 tomcat-power.gif
03/10/2011  03:44 PM             6,074 tomcat.css
03/10/2011  03:44 PM             2,066 tomcat.gif
03/10/2011  03:44 PM             5,103 tomcat.png
03/10/2011  03:44 PM            67,792 tomcat.svg
06/12/2011  05:16 AM <DIR>          WEB-INF
              16 File(s)        162,791 bytes
               3 Dir(s)  245,526,085,632 bytes free

C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\webapps\ROOT>





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to