Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem to show image generated from servlet  RSS feed

 
luca invernizzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a problem with a Servet that generated an image (QRcode).


The Servlet is:




In the JSP page I want to display the image with:



But the image result empty and it show nothing.

I tried to set a button to show the image in an other page and it works:



What is the problem with the img tag?
How can I correctly display also in the page with the img tag??
I have to modify the Servlet?

 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your image generation is inside the doPost method, normally at form submission.

If your QR code image has nothing to do with the form inputs, you can generate the image when the JSP page loads (in the servlet doGet method).
 
luca invernizzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you,

with doGet it works!

Now I'll use process request and it works with the form-post and with the img tag.

Thanks a lot!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!