dealservice.java~23~

来自「采用web2.0技术,采用动态标签,sql语句全部存储在数据库里面.开发速度快.」· JAVA~23~ 代码 · 共 75 行

JAVA~23~
75
字号
package com.sztheater.biz.service;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class DealService extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=GBK";
    private OrderThread thread = null;

    //Initialize global variables
    public void init() throws ServletException {
        try {
            thread = new OrderThread();
            thread.start();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {

        doPost(request,response);

    }

    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {
        String strProduct = "", strCmd = "";

        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();

        request.setCharacterEncoding("gb2312");
        strProduct = request.getParameter("product_name");
        if (strProduct == null) {
            strProduct = "";
        }

        if (strProduct == null || strProduct.length() == 0) {
            thread.shutdown();
            try {
                Thread.sleep(5000);
            } catch (Exception eSlee) {}
            thread.start();

            out.println("<html>");
            out.println("<head><title>RouteService</title></head>");
            out.println("<body bgcolor=\"#ffffff\">");
            out.println("<p>Refresh route OK</p>");
            out.println("</body></html>");
        }
    }

    //Clean up resources
    public void destroy() {
        try {
            thread.shutdown();
        } catch (Exception eStop) {
            eStop.printStackTrace();
        }
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?