i know it does not make any sense calling doPost method of servlet from img tag src:
<img src='/ServletName' alt=''/>// i know it will call doGet or service method but i can't use these.
So is there any way calling doPost method from img tag of html and show image in img tag?
Actually my doPost method response type is :
response.setContentType("image/jpeg");
also i cannot store image on disk of server.
No. That’s just the contract of HTML
<img>element. The webbrowser must download the image by a GET request on the URL as specified insrcattribute.Just do the image serving job in
doGet()method instead. Even more, you can just renamedoPosttodoGet. The logic doesn’t need to be changed at all.