1、qrcode.jar下载的地址是:http://download.csdn.net/download/ilovejavas/6767365
2、下面是代码实现:
2.1、用来设置二维码一些基本参数的pojo类如下:
package kingpoint.qrcode.entity;
import java.io.Serializable;
public class Entity_Qrcode implements Serializable{
private static final long serialVersionUID = 1L;
/**
* 内容
*/
private String content;
/**
* 二维码图片地址
*/
private String qrcodePath;
/**
* logo图片地址
*/
private String logoPath;
/**
* 二维码图片的宽度
*/
private int width;
/**
* 二维码图片的高度
*/
private int height;
/**
* 是否添加logo图片
*/
private boolean isFlag;
/**
* 生成图片的格式
*/
private String format;
/**
* 纠错级别
*/
private char qrcodeErrorCorrect;
/**
* 编码模式
*/
private char qrcodeEncodeModel;
/**
* 设置二维码版本
*/
private int version;
/** getter and setter */
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getQrcodePath() {
return qrcodePath;
}
public void setQrcodePath(String qrcodePath) {
this.qrcodePath = qrcodePath;
}
public String getLogoPath() {
return logoPath;
}
public void setLogoPath(String logoPath) {
this.logoPath = logoPath;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;