kaptcha的使用比较方便,只需添加jar包依赖之后简单地配置就可以使用了 kaptcha所有配置都可以通过web.xml来完成
使用kaptcha生成图片验证码 生成图片验证码必须要引用到的包,下载后引入项目即可
依赖的jar包
kaptcha-0.0.9.jar
filters-2.0.235-1.jar
@RequestMapping("/kaptcha.jpg")
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception{
// Set to expire far in the past.
response.setDateHeader("Expires", 0);
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Contr