Struts2下验证码的实现
http://www.doczj.com/doc/74ce9a87af1ffc4fff47ace6.html/blog/1300116
struts2;struts2验证码;java验证码;jsp验证码
项目中要用到验证码功能,所以实现后在此记录下来实现代码,以备日后用。首先是action
UserLoginVerificationCodeActionImpl.java
Java代码
1.package action.impl;
2.
3.import java.io.ByteArrayInputStream;
4.import java.io.IOException;
5.
6.import javax.servlet.http.HttpSession;
7.
8.import system.SysAction;
9.import tool.ImageCode;
10.import tool.RandomCodeImage;
11.
12.public class UserLoginVerificationCodeActionImpl extends Sy
sAction implements
13. UserLoginVerificationCodeAction {
14.
15. private String code;
16.
17. private ByteArrayInputStream inputStream;
18.
19. private static final long serialVersionUID = 1234
56756789765L;
20.
21. /**
22. * @return the code
23. */
24. public String getCode() {
25. return code;
26. }