/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yuntong.action.ajaxaction;

import java.io.PrintWriter;
import java.util.Random;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/** 
 * MyEclipse Struts
 * Creation date: 03-25-2007
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 */
public class Y_CheckNumAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		 response.setContentType("text/html");
	        try {
	            PrintWriter out = response.getWriter();

	            //创建随即数
	            Random ra1 = new Random();
	            Random ra2 = new Random();
	            Random ra3 = new Random();
	            Random ra4 = new Random();
	            int ck1 = (int) (ra1.nextFloat() * 10);
	            int ck2 = (int) (ra2.nextFloat() * 10);
	            int ck3 = (int) (ra3.nextFloat() * 10);
	            int ck4 = (int) (ra4.nextFloat() * 10);
	            //设置随即数字
	            HttpSession session = request.getSession();
	            session.setAttribute("num1", ck1 + "");
	            session.setAttribute("num2", ck2 + "");
	            session.setAttribute("num3", ck3 + "");
	            session.setAttribute("num4", ck4 + "");
	            //返回
	            out.print(ck1);
	            out.print(ck2);
	            out.print(ck3);
	            out.print(ck4);

	        } catch (Exception ex) {
	            ex.printStackTrace();
	        }
	        return null;

	}
}