I am trying to display images using an HTML page created by a servlet.
I am using Jetty 6.18 as the web server.
The problem is I’m not sure where to store the image files and how to register them (if needed), since the HTML returned to the client is generated by a servlet.
Let’s say I want to write a tag <img src="what_to_write_here?!"> in the HTML. Where should it reference?
Thanks!
It should point to a valid URL. E.g. absolute
<img src="http://example.com/images/foo.jpg">or relative<img src="images/foo.jpg">. You can just map a local disk file system folder on the given URL, or register a servlet to listen on that URL which in turn gets the image asInputStreamfrom disk and writes it toOutputStreamof the response (you can find here a basic example).