Package jsswt.sendsms; / ** * *
Title: purchase, supply and demand, cooperation information display p> *
description: * Import page Click SWT / SWCenter.jsp Execute StockServlet, ProvideServlet, CooperateServlet P> * Function: Bring purchase, supply and demand and cooperation information. In the supply and demand business, the * stockServlet (ProvideServlet, CooperateServlet) is implemented, and the SQL statement .ServletName name * Datasource name. Back page URL address. * Returns SWT / INDEX_INFO.JSP. *
Copyright: Copyright (C) 2004 P> *
Company: LNGL P> * @Author: flyying * @version 1.0 * /
Import java.io. *; import java.util. *; import javax.servlet. *; import javax.servlet.http. *; import jsswt.sendsms.dbo;
Public class Pagelet Extends httpservlet {public long currentpage = 1; // Current page private string sales = "1"; // select page public string sql = ""; // SQL statement for obtaining query results PUBLIC SQL1 = NULL; // SQL statement for acquiring the total number PABLIC Vector PageData = new vector (); // pagedata Used to store the JSP page displayed PUBLIC HTTPSESSION session = null; // pagedata exists in the session and then read in ShowData.jsp take public HttpServletRequest request = null; // declare variables request public HttpServletResponse response = null; // declaration response variable public dBO dbo = null; // declaration for the pattern layer communication dbo public String dataSource = "dataSource"; public int totalRec ; // Total number of records PUBLIC Long Totalpage; // Total PUBLIC INT PAGESIZE = 12; // Sets the number of entries for each page Display data public string servletname; // servletname name public string css; // Temporary useless Public intertage; public string URL1; public string type; // parameter: difference is which information is different. (Buy, Supply and Demand, Cooperation) Public String SelProvince = "0000"; // init method Declaration servlet PUBLIC void init () throws ServletException {System.out.println ( "123423653456746574785678");} public void showData () {// save data to a display the session session.setAttribute ( "selProvince", selProvince); session.setAttribute ( "pageData", pageData); request.setAttribute ( "servletname", servletName); request.setAttribute ( "totalrec", String.valueOf (totalRec)); request.setAttribute ( "currentpage", String.valueOf (currentPage));
try {// call showdata.jsp display RequestDispatcher requestDispatcher = request.getRequestDispatcher (url1); requestDispatcher.forward (request, response);} catch (Exception ex) {ex.printStackTrace ();}} public final void doGet (HttpServletRequest request , HttpServletResponse response) throws ServletException, IOException {try {response.setContentType ( "text / html; charset = GBK"); this.request = request; this.response = response; this.session = request.getSession (); String ssss = Request.getParameter ("page"); type = request.getParameter ("type"); request.setttribute ("type", type); // Save. Page call. IF (SQL! = null || SQL! = "") {} else {string aaa = request.getParameter ("sql"); sql = aaa;}
INT AA = 0; if (SSSS! = null) {aa = integer.parseint (SSSS);} sell = request.getParameter ("Selpage"); if (Selpage! = Null) {currentpage = integer.parseint (Selpage) }
IF (aa == -1) {currentpage = 1;} else {if (aa == -2) {currentpage = currentpage-1;} else {ix (aa == -3) {currentpage = currentpage 1;} }}}} // CurrentPage = INTEGER.PARSEINT (SSSS); // Instance DBO Object DBO = New DBO (this, DataSource); if (SQL1! = NULL) {TotalRec = dbo.QueryTotalRec (SQL1);} else {TotalRec = DBO.QueryTotal (SQL);} pagedata = dbo.QueryPage (TotalRec, SQL, CurrentPage, PageSize); if (TotalRec == 0) {TotalRec = dbo.gettotalRec ();} showdata ();} catch (Exception EX) {EX.TOSTRING ();}} public final void dopost (httpservletRequest Request, httpservletResponse response) throws servletexception, ioException {doget (request, response); }