1、关于验证码的工具类
package com.test.utils;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.util.Random;
public class Captcha {
private BufferedImage image;
private String captcha;
private static char code[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789".toCharArray();
public static final String SESSION_CODE_NAME = "code";
private Captcha() {
init();
}
public static Captcha Instance() {
return new Captcha();
}
public BufferedImage getImage() {
return this.image;
}
public String getString() {
return this.captcha;
}
private void init() {
int width = 170, height = 40;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Gra