先去网上搞个验证码工具类
拿来用就完事了
测试一下public static void main(String[] args) throws IOException {OutputStream fos = new FileOutputStream("E://b.jpg");String outputVerifyImage = CasualCheckCodeUtil.outputVerifyImage(100, 50, fos, 4);System.out.println(outputVerifyImage);}
验证码展示
Register.jsp中添加验证码

接下来写servlet
jsp中增加验证码图片替换功能 此处用到时间能够防止浏览器缓存导致图片不更换 是一项常用技术
验证码校验
添加将验证码送入session的功能
再修改register


