struts2+hibernate 实现B2C电子商务网站的登录注册中验证码的实现
下边只在注册中实现 1、首先是在Action中写出生成验证码所需的方法(下边是在MemberAction.java中写) [java] view plaincopyprint? 01.package csdn.dbshop.action; 02. 03.import org.apache.struts2.ServletActionContext; 04. 05.import csdn.dbshop.domain.Admin; 06.import csdn.dbshop.domain.Member; 07.import csdn.dbshop.service.BaseService; 08.import csdn.dbshop.service.MemberService; 09.import csdn.dbshop.service.impl.BaseServiceImpl; 10.import csdn.dbshop.service.impl.MemberServiceImpl; 11.import csdn.dbshop.util.Pagination; 12.import csdn.dbshop.util.StringUtil; 13. 14.import java.awt.Color; 15. 16.import java.awt.Font; 17. 18.import java.awt.Graphics; 19. 20.import java.awt.image.BufferedImage; 21. 22.import java.io.IOException; 23. 24.import java.util.Random; 25. 26.import javax.imageio.ImageIO; 27. 28.import javax.servlet.http.HttpServletRequest; 29. 30.import javax.servlet.http.HttpServletResponse; 31. 32.import javax.servlet.http.HttpSession; 33. 34.public class MemberAction extends BaseAction{ 35. private BaseService baseService = new BaseServiceImpl(); 36. private MemberService memberService = new MemberServiceImpl(); 37. private String cuemail; 38. private boolean cueflag; 39. private Member member; 40. private String acodet; 41. private boolean cacodet; 42. private String sRand = ""; 43. private String acode; 44. 45. public void setAcode(String acode) { 46. this.acode = acode; 47. } 48. 49. public boolean isCacodet() { 50. return cacodet; 51. } 52. 53. public void setAcodet(String acodet) { 54. this.acodet = acodet; 55. } 56. 57. public void setMember(Member member) { 58. this.member = member; 59. } 60. 61. public Member getMember() { 62. return member; 63. } 64. 65. public boolean isCueflag() { 66. & [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
|