Suppose there is some code:
PrintWriter out = response.getWriter(); out.write(getPageWithImage(imagePath)); out.close(); Inside the getPageWithImage method, we generate html markup, and in the img tag we put our image, whose path we passed to the method.
Question: how do I display? The path that will be specified in the html markup will be local: C:/example/images. How to make the path relevant to the localhost:8080/servlet/img.png ?