www.pudn.com > restrant.zip > TrackOrder.java, change:2014-03-08,size:1815b


package com.alex.restrantol.servlet; 
 
import java.io.IOException; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import com.alex.restrantol.dao.OrderlineDao; 
import com.alex.restrantol.entity.PageEntity; 
 
public class TrackOrder extends HttpServlet { 
 
	public void service(HttpServletRequest req, HttpServletResponse res) 
			throws ServletException, IOException { 
				req.setCharacterEncoding("utf-8"); 
				res.setCharacterEncoding("utf-8"); 
				String type = req.getParameter("type"); 
				int currentPage = 1; 
				String p = req.getParameter("page"); 
				if(p!=null){ 
					currentPage = Integer.parseInt(p); 
				} 
				if ("findOrders".equals(type)) { 
					PageEntity pageEntity = new OrderlineDao().getPageEntity(currentPage); 
					req.setAttribute("pageEntity", pageEntity); 
					req.getRequestDispatcher("/WEB-INF/orderManage/trackOrder.jsp").forward(req, res); 
				}else if("findByCommand".equals(type)){ 
					String status = "1"; 
					String str = req.getParameter("status"); 
					if(str != null) status = str; 
					PageEntity pageEntity = new OrderlineDao().getPageEntity(status,currentPage,1); 
					System.out.println(status); 
					req.setAttribute("pageEntity", pageEntity); 
					req.getRequestDispatcher("/WEB-INF/orderManage/trackOrder.jsp").forward(req, res); 
				}else if("search".equals(type)){ 
					String sFlag = req.getParameter("sFlag"); 
					String content = req.getParameter("content"); 
					PageEntity pageEntity = new OrderlineDao().getPageEntity(content,currentPage,2); 
					req.setAttribute("pageEntity", pageEntity); 
					req.getRequestDispatcher("/WEB-INF/orderManage/trackOrder.jsp").forward(req, res); 
				} 
		} 
	}