You can store the uploaded file either in the database or on the file system out side of your web application. If you are storing your file on file system, make sure to externalize the path through properties file so that you can change the location as and when required.
In the latter case, there is no URL as the image files are not part of the web application. In this case, one way to deal with this is that a servlet is written that knows how to find the image file (which could be identified via a request or path parameter) and to read it from the file system, and then stream it to the response, setting the appropriate headers to identify it as an image.
You don't need to write any servlet to retrieve the file if you are using
tomcat.
In order to get the http url for the uploaded file (incase you use file system on server) in tomcat, you will have to map that path to logical path by modifying your server.xml.
<context crosscontext="true" docbase="c:\\temp\imgService" path="/imgService"></context>
In the above example, physical path c:\\temp\imgService is mapped to /imageService so if you have a image named image1.jpg in c:\\temp\imgService , you can refer the same in
your html as
http://localhost:8080/imageService/image1.jpg .
Note : Assuming you are running tomcat on localhost and on port 8080.