Alright! what I learnt is,
1. Not to store uploaded images in application directory. This is because when newer version of .war is deployed, it will override the folders and you will lose all images. Also in general it is not a good practice to do so.
2. Not to store uploaded images in the database to avoide performance issue.
So now I am storing images on file system outside webapp directory using following code.
To display images on
jsp page, I am mapping the disk path to logical path by modifying your server.xml to add new context as below,
<context crosscontext="true" docbase="C:/MyApplication/UploadedImages/" path="/imgService"></context>
and then in JSP, use something like,
<img
<br />
<br /> hope this is a correct approach that is used in the many more similar applications
<br />
<br />
<br />
<br />
<br />
<br /> >