本文主要是介绍JFinal 验证码绘制,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
很丑的验证码
import com.jfinal.kit.HashKit;
import com.jfinal.kit.LogKit;
import com.jfinal.kit.StrKit;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;/*** 移动端验证码* Created by Admin on 2017/10/10.*/
public class MobileCaptcha {// 默认的验证码大小private static final int WIDTH = 108, HEIGHT = 40;private static String captchaName = "mycaptcha";//随机的数字private static final String[] strArr = {"3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H","J", "K", "M", "N", "P", "Q", "R", "S","T", "U", "V", "W", "X", "Y"};/*** 设置 captchaName*/public static void setCaptchaName(String captchaName) {if (StrKit.isBlank(captchaName)) {throw new IllegalArgumentException("captchaName can not be blank.");}MobileCaptcha.captchaName = captchaName;}//验证码字体(字体,风格,字号)priva
这篇关于JFinal 验证码绘制的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!