https://github.com/kenglxn/QRGen/blob/master/dist/qrgen-1.0.jar
http://code.google.com/p/zxing
Project Structure:-
QRCode Servlet:-
package com.sandeep.qr.demo;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.glxn.qrgen.image.ImageType;
import net.glxn.qrgen.QRCode;
/**
* Servlet implementation class QRResponseDemoServlet
*/
public class QRResponseDemoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public QRResponseDemoServlet() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ByteArrayOutputStream qrImageOutput = QRCode.from("My Small Tutorials").to(
ImageType.PNG).stream();
response.setContentType("image/png");
response.setContentLength(qrImageOutput.size());
OutputStream outStream = response.getOutputStream();
outStream.write(qrImageOutput.toByteArray());
outStream.flush();
outStream.close();
}
}