views:

24

answers:

2

Hi!

I would to get qr code from google chart API in my servlet (e.g. http://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=M&chl=hello). What libraries (jars) do i need and how should i save the response (maybe to byte array?)

A: 

What do you want to do with the image? If you want to just display it to the user, a simple <a href="..."> will suffice. if you want to do some processing (save it in a database, etc), open a connection (new URL("...").openStream()) and then either use ImageIO to get the image (as an image) or read the bytes.

Tassos Bassoukos
I was complicating the whole thing unnecessary. Tnx
DixieFlatline
A: 

If you're trying to just display the image to the user you don't need to do the HTTP GET request, just print the relevant HTML to the page and the client will do the request:

<img src="<your URL>" />
BruteForce