www.pudn.com > BeiJie.rar > EnterCheckServlet.java
package enterCheckServlet;
import java.io.IOException;
import java.util.Vector;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import operation.EnterCheckOperation;
import entity.EnterPageBean;
public class EnterCheckServlet extends HttpServlet
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructor of the object.
*/
public EnterCheckServlet()
{
super();
}
/**
* Destruction of the servlet.
*/
public void destroy()
{
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @param request
* the request send by the client to the server
* @param response
* the response send by the server to the client
* @throws ServletException
* if an error occurred
* @throws IOException
* if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doPost(request, response);
}
/**
* The doPost method of the servlet.
*
* This method is called when a form has its tag value method equals to
* post.
*
* @param request
* the request send by the client to the server
* @param response
* the response send by the server to the client
* @throws ServletException
* if an error occurred
* @throws IOException
* if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("程序运行进入EnterCheckServlet");
String stockid = request.getParameter("stockid");
System.out.println(stockid);
if(stockid==null||stockid.equals(""))
{
System.out.println("fd");
String startyear=request.getParameter("startyear");//璧峰骞翠唤
String startmonth=request.getParameter("startmonth");
String startday=request.getParameter("startday");//寮�濮嬪ぉ鏁�
String endyear=request.getParameter("endyear");
String endmonth=request.getParameter("endmonth");
String endday=request.getParameter("endday");//缁堟鏃ユ湡
String starttime=startyear+"-"+startmonth+"-"+startday;//寮�濮嬫椂闂�
String endtime=endyear+"-"+endmonth+"-"+endday;//缁撴潫鏃堕棿
// EnterCheckOperation entercheckoperation = new EnterCheckOperation();// 鏋勯�犳搷浣滆繘璐х殑绫汇��
// ArrayList list = entercheckoperation.getEnterCheckArrayList(starttime,endtime);// 鑾峰彇鍏充簬杩涜揣鐨勪竴缁勫��
// Iterator it=list.iterator();
// while(it.hasNext())
// {
// EnterCheckView temp=(EnterCheckView)it.next();
// System.out.println(temp.getEnterID());
// }
// request.setAttribute("list", list);
// RequestDispatcher requestDispatcher = request.getRequestDispatcher("/entercheck.jsp");
// requestDispatcher.forward(request,response);
EnterCheckOperation eco = new EnterCheckOperation();
String jumpPage = (String)request.getParameter("jumpPage");
if(jumpPage==null||jumpPage.equals(""))
{
jumpPage="1";
}
request.setAttribute("startyear", startyear);
request.setAttribute("startmonth", startmonth);
request.setAttribute("startday", startday);
request.setAttribute("endyear", endyear);
request.setAttribute("endmonth", endmonth);
request.setAttribute("endday", endday);
EnterPageBean epb=null;
try
{
epb = eco.listData(jumpPage, starttime, endtime);
request.setAttribute("epb", epb);
RequestDispatcher requestDispatcher = request.getRequestDispatcher("/entercheck.jsp");
requestDispatcher.forward(request,response);
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
EnterCheckOperation eco = new EnterCheckOperation();
try
{
Vector v = eco.getStockID(stockid);
request.setAttribute("v", v);
RequestDispatcher requestDispatcher = request.getRequestDispatcher("/entercheck.jsp");
requestDispatcher.forward(request,response);
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* Initialization of the servlet.
*
* @throws ServletException
* if an error occure
*/
public void init() throws ServletException
{
// Put your code here
}
}