oginerror"; 126. } 127. 128. } 129. 130. public String checkAcodet() { 131. if (((String) ServletActionContext.getRequest().getSession() 132. .getAttribute("checkcode")).equalsIgnoreCase(acodet)) { 133. cacodet = true; 134. } else { 135. cacodet = false; 136. } 137. 138. return "checkacode"; 139. } 140. 141. 142. 143. 144./** 145. * ****************** * Action生成验证码* ****************** 146. */ 147. private Font imgFont = new Font("Times New Roman", Font.BOLD, 17); 148. 149. Color getRandColor(int fc, int bc) { 150. 151. Random random = new Random(); 152. 153. if (fc > 255) { 154. 155. fc = 255; 156. 157. } 158. 159. if (bc > 255) { 160. 161. bc = 255; 162. 163. } 164. 165. int r = fc + random.nextInt(bc - fc); 166. 167. int g = fc + random.nextInt(bc - fc); 168. 169. int b = fc + random.nextInt(bc - fc); 170. 171. return new Color(r, g, b); 172. 173. } 174. 175. public void checkCodeImage() { 176. 177. HttpServletRequest request = ServletActionContext.getRequest(); 178. 179. HttpServletResponse response = ServletActionContext.getResponse(); 180. 181. response.setHeader("Pragma", "No-cache");&上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
|