I am working in a web application in witch I need to add the functionality to upload image for a perticular product and document if any to display them wherever is needed. I am using JBOSS and Struts.
I did it but wonder in following scenerios...
1. If I am giving relative path to upload it inside C:\jboss,(using classPath already set) but don't know how to display these images in a JSP(these are stored outside of context of an web application).
2. if I am using getServlet().getServletContext().getRealPath("/")+"images", to store the images, it is storing @ 'C:\jboss\server\default\tmp\deploy\tmp8651vinapp.ear-contents\vinweb-exp.war'. so as soon as Jboss restarted all images get lost.
Can you please suggest me what should be the proper way to upload and save (location) the image (preferably outside of ear) and also to display those images from that location over JSP. due to certain restriction I can not save images i Database.
I'd suggest keeping the files outside the web context. When you want to display them in a JSP, use an action to retrieve the file and download it to the user. On the JSP side, you can do something like this: