struts2生成验证码

时间:2019-01-15 15:27:53
【文件属性】:
文件名称:struts2生成验证码
文件大小:12.75MB
文件格式:RAR
更新时间:2019-01-15 15:27:53
验证码 struts2 生成验证码图片主要涉及到两个类: 1.SecurityCode.java --- 生成验证码 SecurityCode类中提供的验证码分三个难度,易(全数字)、中(数字+小写英文)、难(数字+大小写英文)。难度使用枚举SecurityCodeLevle表示,避免使用1、2、3这样没有明确意义的数字来区分。同时,还控制了能否出现重复的字符。 2.SecurityImage.java --- 图片 有了SecurityCode类提供的验证码,就应该考虑怎么在图片上写字符串了。在Java中操作图片,需要使用BufferedImage类,它代表内存中的图片。写字符串,就需要从图片BufferedImage上得到绘图图面Graphics,然后在图面上drawString。为了使验证码有一定的干扰性,也绘制了一些噪点。调用Graphics类的drawRect绘制1*1大小的方块就可以了。
【文件预览】:
vcode
----.settings()
--------org.eclipse.wst.jsdt.ui.superType.name(6B)
--------org.eclipse.wst.common.project.facet.core.xml(252B)
--------org.eclipse.wst.common.component(453B)
--------org.eclipse.wst.jsdt.ui.superType.container(49B)
--------.jsdtscope(500B)
--------org.eclipse.jdt.core.prefs(395B)
----src()
--------com()
--------struts.xml(720B)
----.project(2KB)
----WebRoot()
--------css()
--------admin()
--------META-INF()
--------WEB-INF()
--------js()
--------index.jsp(834B)
----.mymetadata(288B)
----.classpath(529B)
----.myeclipse()

网友评论