📄 validateaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.xfaccp.struts.action.emp;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.xfaccp.base.BaseAction;
/**
* MyEclipse Struts Creation date: 11-01-2007
*
* XDoclet definition:
*
* @struts.action validate="true"
*/
public class ValidateAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
// private Font mFont = new Font("Times New Roman", Font.PLAIN, 18);// 设置字体
//
// private int width = 60;
//
// private int height = 20;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//System.out.print("++++++++++++++");
try {
Validate code = new Validate();
String verifycode = code.randString(4);
//SaveValue.getMap().put(verifyCode, verifycode);
request.getSession().setAttribute("validate", verifycode);
return mapping.findForward("login");
} catch (Exception e) {
e.printStackTrace();
return mapping.findForward("error");
}
}
/* public Color randColor(int fc, int bc) {
fc = fc > 255 ? 255 : fc;
bc = bc > 255 ? 255 : bc;
Random rand = new Random();
int r = fc + rand.nextInt(bc - fc);
int g = fc + rand.nextInt(bc - fc);
int b = fc + rand.nextInt(bc - fc);
Color c = new Color(r, g, b);
return c;
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -