// post方式发送email
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		File file = doAttachment(request);
		EmailAttachment attachment = new EmailAttachment();
		attachment.setPath(file.getPath());
		attachment.setDisposition(EmailAttachment.ATTACHMENT);
		attachment.setName(file.getName());
		MultiPartEmail email = new MultiPartEmail();
		email.setCharset("UTF-8");
		email.setHostName("smtp.sina.com");
		email.setAuthentication("T-GWAP", "dangdang");
		try {
			email.addTo(parameters.get("to"));
			email.setFrom(parameters.get("from"));
			email.setSubject(parameters.get("subject"));
			email.setMsg(parameters.get("body"));
			email.attach(attachment);
			email.send();
			request.setAttribute("sendmail.message", "邮件发送成功!");
		} catch (EmailException e) {
			Logger logger = Logger.getLogger(SendAttachmentMailServlet.class);
			logger.error("邮件发送不成功", e);
			request.setAttribute("sendmail.message", "邮件发送不成功!");
		}
		request.getRequestDispatcher("/sendResult.jsp").forward(request,
				response);
	}
示例#2
0
  public ActionForward execute(
      ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    try {
      GpsImportForm gpsForm = (GpsImportForm) form;
      User user = (User) req.getSession().getAttribute("user");
      int entryId = gpsForm.getEntryId();
      String fileName = gpsForm.getFileName();
      String title = gpsForm.getTitle();
      String activityId = gpsForm.getActivityId();
      String xml = gpsForm.getXml();
      log.debug(xml);

      List<GpsTrack> tracks = new TcxParser().parse(xml.getBytes());
      GpsTrack track = tracks.get(0); // Horrible hack.
      createAttachment(user, entryId, fileName, title, activityId, track);
      createGeotag(fileName, track);

      req.setAttribute("status", "success");
      req.setAttribute("message", "");
      log.debug("Returning status: success.");
      return mapping.findForward("results");
    } catch (Exception e) {
      log.fatal("Error processing incoming Garmin XML", e);
      req.setAttribute("status", "failure");
      req.setAttribute("message", e.toString());
      return mapping.findForward("results");
    }
  }
  public Event perform(HttpServletRequest request) throws HTMLActionException {

    HttpSession session = request.getSession();
    // look up the adventure transportation
    AdventureComponentManager acm =
        (AdventureComponentManager) session.getAttribute(AdventureKeys.COMPONENT_MANAGER);
    Cart cart = acm.getCart(session);
    String origin = request.getParameter("origin");
    // if we are doing a search for a different flight from the cart page
    if (origin == null) {
      origin = cart.getOrigin();
    } else {
      cart.setOrigin(origin);
    }

    String noTransport = request.getParameter("no_transport");
    String showTransport = request.getParameter("show_flights");
    Locale locale = new Locale("en", "us");
    String destination = cart.getDestination();
    // access catalog component and retrieve data from the database
    List transpDepartureBeans = searchTransportation(origin, destination, locale);
    List transpReturnBeans = searchTransportation(destination, origin, locale);

    // places result bean data in the request
    request.setAttribute("departure_result", transpDepartureBeans);
    request.setAttribute("return_result", transpReturnBeans);
    request.setAttribute("search_target", "transportation");
    return null;
  }
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    String amount = request.getParameter("amount");
    String amount2 = request.getParameter("amount2");
    String amount3 = request.getParameter("amount3");
    Integer posotita = Integer.parseInt(amount);
    Integer posotita2 = Integer.parseInt(amount2);
    Integer posotita3 = Integer.parseInt(amount3);

    HttpSession session = request.getSession();

    if (session.isNew()) {
      request.setAttribute("sessionVal", "this is a new session");
    } else {
      request.setAttribute("sessionVal", "Welcome Back!");
    }

    double total = ((posotita * 18.50) + (posotita2 * 6.95) + (posotita3 * 1.29));
    session.setAttribute("totalVal", total);

    request.setAttribute("currency", total);
    request.setAttribute("from", amount);
    request.setAttribute("from2", amount2);
    request.setAttribute("from3", amount3);

    RequestDispatcher view = request.getRequestDispatcher("index.jsp");
    view.forward(request, response);
  }
  static void html(HttpServletRequest request) throws Exception {
    String url = request.getParameter("url");
    String retUrl = request.getParameter(S3Servlet.URL_PARAM);
    if (retUrl == null && !S3Servlet.testing)
      throw new Exception("Recieved no launch presentation return url");

    request.setAttribute("linkAction", S3Servlet.prefix + "/" + S3Action.link);
    request.setAttribute("iframeAction", S3Servlet.prefix + "/" + S3Action.iframe);
    request.setAttribute(S3Servlet.URL_PARAM, retUrl);
    request.setAttribute("url", url);
  } // flashOrLink//
 /**
  * Utilizado como controlador de página para la acción de listar medidores.
  *
  * @param request
  * @param response
  * @throws ServletException
  * @throws IOException
  */
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   MedidorModule module = (MedidorModule) context.getBean("medidorModule");
   try {
     List data = module.listado();
     request.setAttribute("medidores", data);
     forward("/listaMedidores.jsp", request, response);
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward("/paginaError.jsp", request, response);
   }
 }
示例#7
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AcueductoModule module = (AcueductoModule) context.getBean("acueductoModule");
    try {
      List data = module.listado();
      request.setAttribute("acueductos", data);
      forward("/listaAcueductos.jsp", request, response);
    } catch (Exception e) {

      request.setAttribute("mensaje", e.getMessage());
      forward(e.getMessage(), request, response);
    }
  }
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   ProfesorRepository profesores = (ProfesorRepository) context.getBean("profesorRepository");
   try {
     String id = request.getParameter("id");
     int idProf = Integer.parseInt(id);
     String cedula = request.getParameter("cedula");
     String nombre = request.getParameter("nombre");
     String titulo = request.getParameter("titulo");
     String area = request.getParameter("area");
     String telefono = request.getParameter("telefono");
     Profesor prof = profesores.findProfesor(idProf);
     try {
       if (cedula != null) prof.setCedula(cedula);
       if (nombre != null) prof.setNombre(nombre);
       if (titulo != null) prof.setTitulo(titulo);
       if (area != null) prof.setArea(area);
       if (telefono != null) prof.setTelefono(telefono);
       profesores.updateProfesor(prof);
     } catch (Exception e) {
     }
     response.sendRedirect("listaProfesores");
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward("/paginaError.jsp", request, response);
   }
 }
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   EstacionBombeoModule module = (EstacionBombeoModule) context.getBean("estacionBombeoModule");
   try {
     String presionSalida = request.getParameter("presionSalida");
     int presionSalidaObj = Integer.parseInt(presionSalida);
     String presionEntrada = request.getParameter("presionEntrada");
     int presionEntradaObj = Integer.parseInt(presionEntrada);
     String cantidadBombas = request.getParameter("cantidadBombas");
     int cantidadBombasObj = Integer.parseInt(cantidadBombas);
     String capacidadMaxima = request.getParameter("capacidadMaxima");
     int capacidadMaximaObj = Integer.parseInt(cantidadBombas);
     String idAcueducto = request.getParameter("idAcueducto");
     int idAcueductoObj = Integer.parseInt(idAcueducto);
     String encargado = request.getParameter("encargado");
     String tipo = request.getParameter("tipo");
     String telefono = request.getParameter("telefono");
     String nombreEstacion = request.getParameter("nombreEstacion");
     module.insertar(
         presionSalidaObj,
         tipo,
         capacidadMaximaObj,
         cantidadBombasObj,
         encargado,
         telefono,
         presionEntradaObj,
         idAcueductoObj,
         nombreEstacion);
     response.sendRedirect("listaEstacionBombeos");
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward(e.getMessage(), request, response);
   }
 }
示例#10
0
  public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    // res.setContentType("text/html");
    // PrintWriter pw = res.getWriter();
    // pw.println("Beer selection advice<br/>");
    BeerExpert be = new BeerExpert();
    String c = req.getParameter("color");
    List result = be.getBrands(c);

    req.setAttribute("styles", result);

    String email = getServletConfig().getInitParameter("adminEmail");
    RequestDispatcher view = req.getRequestDispatcher("result.jsp");
    // try{
    view.forward(req, res);
    // } catch (Exception e) {
    // 	System.out.println("some thing wrong in view.forward");
    // 	e.printStackTrace();
    // }

    // Iterator it = result.iterator();
    // while(it.hasNext()){
    // 	pw.println("<br/> tyr: " + it.next());
    // }

  }
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    /*	-- pentru codul scris in java
    	response.setContentType("text/thml");
    	PrintWriter out =  response.getWriter();
    	out.println("Beer Selection Advice");
    */
    String c = request.getParameter("color");
    /* se adauga clasa BeerExpert */
    BeerExpert be = new BeerExpert();
    List result = be.getBrands(c);

    /*
     out.println("Got beer color " + c);
    // afisare rezultate din metoda getBrends
     Iterator it = result.iterator();
     while(it.hasNext()){
     	out.println("try: "+ it.next());
     }
    */
    /* cod folosit de aplicatia JSP */
    request.setAttribute("styles", result);
    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request, response);
  }
  private void processRequestDefault(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    request.setAttribute(QueryBuilder.HTML_TITLE, GlobalProperties.getTitle());

    RequestDispatcher dispatcher =
        getServletContext().getRequestDispatcher("/WEB-INF/jsp/tumormap/tumormap.jsp");
    dispatcher.forward(request, response);
  }
示例#13
0
  /**
   * This calls the itemselection.jsp and list all items available for a WorkOrder and a WorkOrder's
   * item list
   *
   * @param workorderid - the WO_ID of the parent WorkOrder
   * @param request - servlet request
   * @param response - servlet response
   */
  private void listProducts(
      long workorderId,
      WorkOrderDetailRemote workorderdetEJBean,
      HttpSession session,
      HttpServletRequest req,
      HttpServletResponse resp) {

    try {
      // If any product object is left over in session remove it
      session.removeValue("itemObj");

      // Create db connection for EJB
      workorderdetEJBean.connect();

      // Get the 2D Array which has the List of Items for the WorkOrder
      // grouped by the Billing System.
      Object[][] productList = workorderdetEJBean.getWorkOrderItems(workorderId);

      // Get the WorkOrder Object
      WorkOrder workorderObj = workorderdetEJBean.getWorkOrderInfo(workorderId);

      // Get the List of all Product Names for the WorkOrder
      String[] productNameList = workorderdetEJBean.getProdList(workorderId);

      for (int w = 0; w < productNameList.length; w++)
        USFEnv.getLog()
            .writeDebug("VALUES INSIDE productNameList is" + productNameList[w], this, null);

      // Set the attributes to the itemselection JSP
      req.setAttribute("productNameList", productNameList);
      req.setAttribute("productList", productList);
      req.setAttribute("workorderObj", workorderObj);

      // Release db connection for EJB
      workorderdetEJBean.release();

      // Include the JSP
      includeJSP(req, resp, ITEM_JSP_PATH, "itemselection");
      return;
    } catch (Exception e) {
      String errorMsg = "Fail to list products for a WORKORDER " + workorderId;
      USFEnv.getLog().writeCrit(errorMsg, this, e);
      errorJSP(req, resp, errorMsg);
    }
  }
  static void flashOrLink(HttpServletRequest request, S3Action action) throws Exception {
    String oembed = request.getParameter("url");

    String[] temp = S3Servlet.parseS3Url(oembed);
    String bucket = temp[0];
    String key = temp[1];
    String prefix = key.contains("/") ? key.substring(0, key.lastIndexOf("/")) : "";

    String retUrl = request.getParameter(S3Servlet.URL_PARAM);
    if (retUrl == null && !S3Servlet.testing)
      throw new Exception("Recieved no launch presentation return url");

    request.setAttribute("action", prefix + "/" + action);
    request.setAttribute(S3Servlet.URL_PARAM, retUrl);
    request.setAttribute("url", oembed);
    request.setAttribute(
        "base", (S3Servlet.cloudBucket.equals(bucket) ? "" : "/" + bucket) + "/" + prefix);
  } // flashOrLink//
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    String nombreChofer = request.getParameter("nombreChofer");
    String telefonoChofer = request.getParameter("telefonoChofer");
    float salarioChofer = Float.parseFloat(request.getParameter("salarioChofer"));
    String choferID = request.getParameter("usernameChofer");

    Chofer c = new Chofer(nombreChofer, telefonoChofer, salarioChofer);
    new ListaChoferes().updateChofer(choferID, c);

    request.setAttribute("mensaje", "Chofer modificado de manera exitosa");
    String color = "10E214";
    request.setAttribute("coloreado", color);
    request.setAttribute("ListaDeChoferes", new ListaChoferes().obtenerChoferes());
    request.getRequestDispatcher("VerChoferes.jsp").forward(request, response);
  }
示例#16
0
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   ProfesorRepository profesores = (ProfesorRepository) context.getBean("profesorRepository");
   try {
     Collection lista = profesores.findAllProfesor();
     List data = new ArrayList();
     Iterator itr = lista.iterator();
     while (itr.hasNext()) {
       Profesor prof = (Profesor) itr.next();
       ProfesorDTO dto = ProfesorAssembler.Create(prof);
       data.add(dto);
     }
     request.setAttribute("profesores", data);
     forward("/listaProfesores.jsp", request, response);
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward("/paginaError.jsp", request, response);
   }
 }
示例#17
0
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   GrupoRepository grupos = (GrupoRepository) context.getBean("grupoRepository");
   try {
     Collection lista = grupos.findAllGrupo();
     List data = new ArrayList();
     Iterator itr = lista.iterator();
     while (itr.hasNext()) {
       Grupo grupo = (Grupo) itr.next();
       GrupoDTO dto = GrupoAssembler.CreateDTO(grupo);
       data.add(dto);
     }
     request.setAttribute("grupos", data);
     forward("/listaGrupos.jsp", request, response);
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward("/paginaError.jsp", request, response);
   }
 }
示例#18
0
 /**
  * Procesa los llamados a listar marcas
  *
  * @param
  * @return
  * @throws IOException
  * @throws ServletException
  */
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   BrandRepository brands = (BrandRepository) context.getBean("brandRepository");
   Collection data_brands = brands.findAllBrand();
   List param_brands = new ArrayList();
   Iterator itr = data_brands.iterator();
   while (itr.hasNext()) {
     Brand brand = (Brand) itr.next();
     BrandDTO dto = BrandAssembler.Create(brand);
     param_brands.add(dto);
   }
   request.setAttribute("brands", param_brands);
   forward("/ListBrands.jsp", request, response);
 }
示例#19
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {

    String c = request.getParameter("type");
    String d = request.getParameter("q");

    Expert ce = new Expert();

    List result = ce.getTypes(c, d);

    getServletContext().setAttribute("SAVED_DATA", result);
    request.setAttribute("styles", result);

    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request, response);
  }
示例#20
0
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    log.info("########## START EDIT EVENT GET ###########");

    // Check for valid user session
    lpo.User user = UserManager.GetUser();

    if (user == null) resp.sendRedirect("WelcomePage.jsp");

    // get event from datastore
    String eventKey = req.getParameter("k");

    // pull the event object out
    lpo.Event event = EventManager.GetEvent(eventKey);

    req.setAttribute("event", event);

    // build display page
    req.getRequestDispatcher("/WEB-INF/EditEvent.jsp").forward(req, resp);
  }
  /** Metodo para actualizar un servicio existente */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AveriaRepository averias = (AveriaRepository) context.getBean("averiaRepository");
    try {
      String codAveria = request.getParameter("codAveria");
      String descripcion = request.getParameter("descripcion");
      String fecha = request.getParameter("fecha");
      String servicio_codServicio = request.getParameter("servicio_codServicio");

      Averia obj = averias.findAveria(codAveria);
      try {
        if (codAveria != null) obj.setCodAveria(codAveria);
        if (descripcion != null) obj.setDescripcion(descripcion);
        if (fecha != null) obj.setFecha(fecha);
        if (servicio_codServicio != null) obj.setServicioCodServicio(servicio_codServicio);
      } catch (Exception e) {
      }
      response.sendRedirect("listaAverias");
    } catch (Exception e) {
      request.setAttribute("mensaje", e.getMessage());
      forward("/paginaError.jsp", request, response);
    }
  }
示例#22
0
 @Override
 public void algorithm(HttpServletRequest request) {
   KNN knn0 = new KNN();
   knn0.processAlgorithm();
   request.setAttribute("time", knn0.ma.getTime());
   request.setAttribute("KNNResult", knn0.result);
   request.setAttribute("accuracyRate", knn0.ma.getAccuracyRate());
   request.setAttribute("errorRate", knn0.ma.getErrorRate());
   double avgAccruacyRate = 0, avgErrorRate = 0;
   for (int i = 0; i < 10; i++) {
     KNN knn = new KNN(new Data(i));
     knn.processAlgorithm();
     avgAccruacyRate += knn.ma.getAccuracyRate();
     avgErrorRate += knn.ma.getErrorRate();
   }
   request.setAttribute("avgAccuracyRate", avgAccruacyRate / 10);
   request.setAttribute("avgErrorRate", avgErrorRate / 10);
 }
示例#23
0
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   TuberiaModule module = (TuberiaModule) context.getBean("tuberiaModule");
   try {
     String id = request.getParameter("id");
     int idObj = Integer.parseInt(id);
     String diametro = request.getParameter("diametro");
     int diametroObj = Integer.parseInt(diametro);
     String largo = request.getParameter("largo");
     int largoObj = Integer.parseInt(largo);
     String presionMaxima = request.getParameter("presionMaxima");
     int presionMaximaObj = Integer.parseInt(presionMaxima);
     String idAcueducto = request.getParameter("idAcueducto");
     int idAcueductoObj = Integer.parseInt(idAcueducto);
     String material = request.getParameter("material");
     String tipo = request.getParameter("tipo");
     String fechaInstalacion = request.getParameter("fechaInstalacion");
     String fechaUltimaInspeccion = request.getParameter("fechaUltimaInspeccion");
     String estado = request.getParameter("estado");
     module.actualizar(
         idObj,
         material,
         diametroObj,
         tipo,
         largoObj,
         presionMaximaObj,
         fechaInstalacion,
         fechaUltimaInspeccion,
         estado,
         idAcueductoObj);
     response.sendRedirect("listaTuberias");
   } catch (Exception e) {
     request.setAttribute("mensaje", e.getMessage());
     forward("/paginaError.jsp", request, response);
   }
 }
  public boolean convalida() {
    boolean tuttoOk = true;
    Map<String, String> errori = new HashMap<String, String>();

    if ((nome == null) || nome.equals("")) {
      tuttoOk = false;
      request.setAttribute("nome", nome);
      errori.put("nome", "campo obbligatorio");
    }

    if ((descrizione == null) || descrizione.equals("")) {
      tuttoOk = false;
      request.setAttribute("descrizione", descrizione);
      errori.put("descrizione", "campo obbligatorio");
    }

    if ((codice == null) || codice.equals("")) {
      tuttoOk = false;
      request.setAttribute("codice", codice);
      errori.put("codice", "campo obbligatorio");
    }

    if (!isInteger(disponibilita)) {
      tuttoOk = false;
      request.setAttribute("disponibilita", disponibilita);
      errori.put("disponibilita", "formato non valido");
    }

    if (!isInteger(prezzo)) {
      tuttoOk = false;
      request.setAttribute("prezzo", prezzo);
      errori.put("prezzo", "formato non valido");
    }
    if (!tuttoOk) request.setAttribute("errori", errori);
    HttpSession sess = request.getSession();
    sess.setAttribute("errori", errori);
    return tuttoOk;
  }
示例#25
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    HttpSession session = request.getSession(false);
    String reseller = null;
    if (session != null && session.getAttribute("reseller") != null)
      reseller = "%" + session.getAttribute("reseller") + "%";
    List<LicenseData> searchResult = null;
    if (reseller != null) {
      /*  session.setAttribute("fieldsearch", true);
      session.removeAttribute("datesearch");*/

      if (request.getParameter("so") != null && !request.getParameter("so").isEmpty()) {

        log.info(
            "Search Fields : Sales Order Search "
                + request.getParameter("so")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("so"), "so");

        session.setAttribute("so", request.getParameter("so"));
        session.removeAttribute("enduser");
        session.removeAttribute("ek");
        session.setAttribute("label", "Sales Order");
        session.setAttribute("value", request.getParameter("so"));

      } else if (request.getParameter("enduser") != null
          && !request.getParameter("enduser").isEmpty()) {

        log.info(
            "Search Fields : End User Search "
                + request.getParameter("enduser")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult =
            getSearchByFieldResults(reseller, request.getParameter("enduser"), "enduser");
        session.setAttribute("enduser", request.getParameter("enduser"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("ek");
        session.setAttribute("label", "End User");
        session.setAttribute("value", request.getParameter("enduser"));

      } else if (request.getParameter("ek") != null && !request.getParameter("ek").isEmpty()) {

        log.info(
            "Search Fields : Entitlement Key Search "
                + request.getParameter("ek")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("ek"), "ek");
        session.setAttribute("ek", request.getParameter("ek"));
        session.removeAttribute("so");
        session.removeAttribute("sno");
        session.removeAttribute("enduser");
        session.setAttribute("label", "Entitlement Key");
        session.setAttribute("value", request.getParameter("ek"));

      } else if (request.getParameter("sno") != null && !request.getParameter("sno").isEmpty()) {

        log.info(
            "Search Fields : Serial Number Search "
                + request.getParameter("sno")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("sno"), "sno");
        session.setAttribute("sno", request.getParameter("sno"));
        session.removeAttribute("ek");
        session.removeAttribute("so");
        session.removeAttribute("enduser");
        request.setAttribute("sno", 1);
        session.setAttribute("label", "Serial Number");
        session.setAttribute("value", request.getParameter("sno"));

      } else if (request.getParameter("po") != null && !request.getParameter("po").isEmpty()) {

        log.info(
            "Search Fields : Purchase Order Search "
                + request.getParameter("po")
                + " for reseller "
                + session.getAttribute("reseller"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("po"), "po");
        session.setAttribute("po", request.getParameter("po"));
        session.setAttribute("label", "Purchase Order");
        session.setAttribute("value", request.getParameter("po"));

      } else if (request.getParameter("hm") != null && !request.getParameter("hm").isEmpty()) {

        log.info(
            "Search Fields : HM ID Search "
                + request.getParameter("hm")
                + " for reseller "
                + session.getAttribute("hm"));

        searchResult = getSearchByFieldResults(reseller, request.getParameter("hm"), "hm");
        session.setAttribute("hm", request.getParameter("hm"));
        session.setAttribute("label", "Hive Manager ID");
        session.setAttribute("value", request.getParameter("hm"));
      }

      session.setAttribute("fieldSearchList", searchResult);
      String nextJSP = "/viewFieldSearchResult.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    } else {

      log.info("Search Fields : Reseller Blank  ");
      String nextJSP = "/login.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
      dispatcher.forward(request, response);
    }
  }
示例#26
0
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String actionName = "";
    String pathInfo = request.getPathInfo();
    String destinationPage = ERROR_PAGE;

    if (inventory == null) {
      String errorMessage = "Inventory EJB reference is null.";
      request.setAttribute(ERROR_KEY, errorMessage);
    } else {

      if (pathInfo != null) {
        actionName = pathInfo.substring(1); // Get the action name from the HTTP Request.
      }

      // perform action
      if (VIEW_CAR_LIST_ACTION.equals(actionName)) {
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (ADD_CAR_ACTION.equals(actionName)) {
        request.setAttribute("car", new CarDTO());
        destinationPage = "/carForm.jsp";
      } else if (EDIT_CAR_ACTION.equals(actionName)) {
        int id = Integer.parseInt(request.getParameter("id"));
        request.setAttribute("car", inventory.findCar(id));
        destinationPage = "/carForm.jsp";
      } else if (SAVE_CAR_ACTION.equals(actionName)) {
        // build the car from the request parameters
        CarDTO car = new CarDTO();
        car.setId(Integer.parseInt(request.getParameter("id")));
        car.setMake(request.getParameter("make"));
        car.setModel(request.getParameter("model"));
        car.setModelYear(request.getParameter("modelYear"));

        // save the car
        inventory.saveCar(car);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (DELETE_CAR_ACTION.equals(actionName)) {
        // get list of ids to delete
        String[] ids = request.getParameterValues("id");

        // delete the list of ids

        inventory.deleteCars(ids);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else if (VIEW_BUY_CAR_FORM_ACTION.equals(actionName)) {
        int id = Integer.parseInt(request.getParameter("id"));
        request.setAttribute("car", inventory.findCar(id));
        destinationPage = "/buyCarForm.jsp";
      } else if (BUY_CAR_ACTION.equals(actionName)) {
        int carId = Integer.parseInt(request.getParameter("id"));
        double price;

        // Use $5000.00 as the default price if the user enters bad data.
        try {
          price = Double.parseDouble(request.getParameter("price"));
        } catch (NumberFormatException nfe) {
          price = 5000.00;
        }

        System.out.println("carId = [" + carId + "], price = [" + price + "]");

        // mark the car as sold
        inventory.buyCar(carId, price);

        // prepare the list
        request.setAttribute("carList", inventory.listAvailableCars());
        destinationPage = "/carList.jsp";
      } else {
        String errorMessage = "[" + actionName + "] is not a valid action.";
        request.setAttribute(ERROR_KEY, errorMessage);
      }
    }

    // Redirect to destination page.
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(destinationPage);

    dispatcher.forward(request, response);
  }
示例#27
0
  // 一周内的污染源在线脱机联机报表
  public static void run7(HttpServletRequest req) throws Exception {

    String gas_station_type = "2";
    String water_station_type = "1";
    String so2_col = "val01";
    String cod_col = "val02";

    Connection cn = null;
    String sql = null;
    List list = new ArrayList(); // 存储这周内的数据
    List list2 = new ArrayList(); // 存储今天的数据
    List list3 = new ArrayList(); // 存储脱机的数据
    List l_temp = null;
    List td_temp = null; // 存储今天的数据
    String kv = null;
    String kv_2 = null;
    Map tmp = null;
    Map tmp_2 = null;

    Map tmp2 = new HashMap();
    Map tmp3 = new HashMap();
    Map data = null; // 存这周内有数据的站位
    Map data2 = null; // 存储今天的数据
    Map data3 = null; // 存储这周脱机的站位
    List waterStationList = null;
    List gasStationList = null;
    // String date = req.getParameter("date");
    String now = StringUtil.getNowDate() + "";
    // String now = req.getParameter("date")+"";//黄宝修改
    String date1, date2 = null;
    // 从现在开始,退后7天。
    Calendar cal = Calendar.getInstance();
    Calendar cal2 = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    cal.setTime(cal.getTime());

    cal.add(Calendar.DAY_OF_MONTH, -7); // 退后7天

    String now_7 = sdf.format(cal.getTime());

    cal2.setTime(cal2.getTime());

    cal2.add(Calendar.DAY_OF_MONTH, -1); // 退后1天

    String now_1 = sdf.format(cal2.getTime()) + " 23:59:59";
    ;
    date1 = sdf.format(cal2.getTime()) + " 23:59:59";
    date2 = now_7 + "";

    Map areaMap = null;
    Map bean = new HashMap();

    int i, num = 0;
    Map m = null;
    String area_id = null;
    try {

      area_id = req.getParameter("area_id");
      if (area_id == null) {
        area_id = "";
      }

      // date1 = req.getParameter("date1");
      // date1 = req.getParameter("date1");

      sql =
          "select station_id,m_time,"
              + so2_col
              + ","
              + cod_col
              + " from "
              + req.getParameter("tableName");
      sql = sql + " where m_time>='" + date2 + "' and m_time<='" + date1 + "'";
      sql = sql + " and station_id in (";
      sql =
          sql
              + "select station_id from t_cfg_station_info where station_type in ('1','2') and area_id like '"
              + area_id
              + "%') order by m_time desc";

      // System.out.println(sql);

      cn = f.getConn();

      // System.out.println(sql);

      l_temp = f.query(cn, sql, null); // 最近一周的数据
      num = l_temp.size();
      for (i = 0; i < num; i++) {
        tmp = (Map) l_temp.get(i);
        kv = (String) tmp.get("station_id");

        String station_id_t = (String) tmp2.get(kv);
        if ("".equals(station_id_t) || station_id_t == null) {
          list.add(tmp); // 最近一周都有的数据
          tmp2.put(kv, kv);
        }
      }

      // data = f.getListMap(list,"station_id");//最近一周都有的数据

      // 查询今天有数据的站位
      String now_time = StringUtil.getNowDate() + "";
      date1 = now_time + "";
      date2 = now_time + " 23:59:59";

      sql =
          "select station_id,m_time,"
              + so2_col
              + ","
              + cod_col
              + " from "
              + req.getParameter("tableName");
      sql = sql + " where m_time>='" + date1 + "' and m_time<='" + date2 + "'";
      sql = sql + " and station_id in (";
      sql =
          sql
              + "select station_id from t_cfg_station_info where station_type in ('1','2') and area_id like '"
              + area_id
              + "%') order by m_time desc";

      td_temp = f.query(cn, sql, null); // 今天的数据
      tmp2 = null;

      num = td_temp.size();
      for (i = 0; i < num; i++) {
        tmp = (Map) td_temp.get(i);
        kv = (String) tmp.get("station_id");

        String station_id_t = (String) tmp3.get(kv);
        if ("".equals(station_id_t) || station_id_t == null) {
          list2.add(tmp); // 今天有数据的站位。
          tmp3.put(kv, kv);
        }
      }

      // 循环这一周内有数据的站位列表list,如果list中的站位不能在今天的站位信息列表中list2中找到的话,则表明是脱机
      num = list.size();
      int j = 0;
      int num2 = list2.size();
      String station_id_1 = "";
      String station_id_2 = "";
      int l = 0;
      for (i = 0; i < num; i++) {
        tmp = (Map) list.get(i);
        station_id_1 = (String) tmp.get("station_id");
        l = 0;
        for (j = 0; j < num2; j++) {
          tmp_2 = (Map) list2.get(j);
          station_id_2 = (String) tmp_2.get("station_id");
          if (station_id_1.equals(station_id_2)) {
            l++;
          }
        }
        if (l == 0) {
          list3.add(tmp);
        }
      }

      data = f.getListMap(list3, "station_id"); // 这周脱机的站位信息列表

      l_temp = null;
      tmp = null;
      list2 = null;
      list3 = null;
      tmp_2 = null;
      tmp3 = null;

      sql =
          "select station_id,station_desc,ep_type,area_id,station_bz from t_cfg_station_info where station_type='1' and area_id like '"
              + area_id
              + "%' order by area_id,station_desc";
      waterStationList = f.query(cn, sql, null);

      // System.out.println(sql);

      sql =
          "select station_id,station_desc,ep_type,area_id from t_cfg_station_info where station_type='2' and area_id like '"
              + area_id
              + "%' order by area_id,station_desc";
      gasStationList = f.query(cn, sql, null);

      // System.out.println(sql);

      sql = "select area_id,area_name from t_cfg_area";
      areaMap = f.getMap(cn, sql);

      // System.out.println(sql);
      num = waterStationList.size();
      for (i = 0; i < num; i++) {
        m = (Map) waterStationList.get(i);
        area_id = (String) m.get("area_id");
        m.put("area_name", areaMap.get(area_id));
      }

      num = gasStationList.size();
      for (i = 0; i < num; i++) {
        m = (Map) gasStationList.get(i);
        area_id = (String) m.get("area_id");
        m.put("area_name", areaMap.get(area_id));
      }

      // System.out.println("before close,cn="+cn);
      f.close(cn);
      // System.out.println("after close,cn="+cn);

      int waterOnlineNum, gasOnlineNum, onlineNum = 0;
      int waterOfflineNum, gasOfflineNum, offlineNum = 0;
      int waterOfflineNumNation, gasOfflineNumNation, offlineNumNation = 0;
      int waterZeroNum, gasZeroNum, zeroNum = 0;
      int waterZeroNumNation, gasZeroNumNation, zeroNumNation = 0;

      waterOnlineNum = OnlineReport.getOnlineNum(waterStationList, data);
      gasOnlineNum = OnlineReport.getOnlineNum(gasStationList, data);
      onlineNum = waterOnlineNum + gasOnlineNum;

      // System.out.println(onlineNum);

      waterOfflineNum = OnlineReport.getOfflineNum(waterStationList, data);
      gasOfflineNum = OnlineReport.getOfflineNum(gasStationList, data);
      offlineNum = waterOfflineNum + gasOfflineNum;

      // System.out.println("zeroNumNation "+zeroNumNation);

      waterOfflineNumNation = OnlineReport.getOfflineNumNation(waterStationList, data);
      gasOfflineNumNation = OnlineReport.getOfflineNumNation(gasStationList, data);
      offlineNumNation = waterOfflineNumNation + gasOfflineNumNation;

      // System.out.println("offlineNumNation "+offlineNumNation);

      waterZeroNum = OnlineReport.getZeroNum(waterStationList, data, cod_col);
      gasZeroNum = OnlineReport.getZeroNum(gasStationList, data, so2_col);
      zeroNum = waterZeroNum + gasZeroNum;

      // System.out.println(zeroNum);

      waterZeroNumNation = OnlineReport.getZeroNumNation(waterStationList, data, cod_col);
      gasZeroNumNation = OnlineReport.getZeroNumNation(gasStationList, data, so2_col);
      zeroNumNation = waterZeroNumNation + gasZeroNumNation;

      // System.out.println(zeroNumNation);

      bean.put("waterOnlineNum", waterOnlineNum + "");
      bean.put("gasOnlineNum", gasOnlineNum + "");
      bean.put("onlineNum", onlineNum + "");

      bean.put("waterOfflineNum", waterOfflineNum + "");
      bean.put("gasOfflineNum", gasOfflineNum + "");
      bean.put("offlineNum", offlineNum + "");

      bean.put("waterOfflineNumNation", waterOfflineNumNation + "");
      bean.put("gasOfflineNumNation", gasOfflineNumNation + "");
      bean.put("offlineNumNation", offlineNumNation + "");

      bean.put("waterZeroNum", waterZeroNum + "");
      bean.put("gasZeroNum", gasZeroNum + "");
      bean.put("zeroNum", zeroNum + "");

      bean.put("waterZeroNumNation", waterZeroNumNation + "");
      bean.put("gasZeroNumNation", gasZeroNumNation + "");
      bean.put("zeroNumNation", zeroNumNation + "");

      date1 = now_7;
      date2 = StringUtil.getNowDate() + "";

      bean.put("date1", date2);
      bean.put("date2", date1);

      req.setAttribute("bean", bean);

      list = getOfflineList2(waterStationList, data);
      req.setAttribute("waterOfflineList", list);

      list = getOfflineList2(gasStationList, data);
      req.setAttribute("gasOfflineList", list);

      list = getOfflineListNation(waterStationList, data);
      req.setAttribute("waterOfflineListNation", list);

      list = getOfflineListNation(gasStationList, data);
      req.setAttribute("gasOfflineListNation", list);

      list = getZeroListNation(waterStationList, data, cod_col);
      req.setAttribute("waterZeroListNation", list);

      list = getZeroListNation(gasStationList, data, so2_col);
      req.setAttribute("gasZeroListNation", list);

    } catch (Exception e) {
      throw e;
    } finally {
      f.close(cn);
    }
  }
示例#28
0
  public static void run(HttpServletRequest req) throws Exception {

    String gas_station_type = "2";
    String water_station_type = "1";
    String so2_col = "val01";
    String cod_col = "val02";

    Connection cn = null;
    String sql = null;
    List list = null;
    Map data = null;
    List waterStationList = null;
    List gasStationList = null;
    // String date = req.getParameter("date");
    // String now = StringUtil.getNowDate()+"";
    String now = req.getParameter("date") + ""; // 黄宝修改
    String date1, date2 = null;
    Map areaMap = null;
    Map bean = new HashMap();
    date1 = now + "";
    date2 = now + " 23:59:59";
    int i, num = 0;
    Map m = null;
    String area_id = null;
    try {

      area_id = req.getParameter("area_id");
      if (area_id == null) {
        area_id = "";
      }

      // date1 = req.getParameter("date1");
      // date1 = req.getParameter("date1");

      sql =
          "select station_id," + so2_col + "," + cod_col + " from " + req.getParameter("tableName");
      sql = sql + " where m_time>='" + date1 + "' and m_time<='" + date2 + "'";
      sql = sql + " and station_id in (";
      sql =
          sql
              + "select station_id from t_cfg_station_info where station_type in ('1','2') and area_id like '"
              + area_id
              + "%')";

      // System.out.println(sql);

      cn = f.getConn();

      // System.out.println(sql);

      list = f.query(cn, sql, null);
      data = f.getListMap(list, "station_id");

      sql =
          "select station_id,station_desc,ep_type,area_id,station_bz from t_cfg_station_info where station_type='1' and area_id like '"
              + area_id
              + "%' order by area_id,station_desc";
      waterStationList = f.query(cn, sql, null);

      // System.out.println(sql);

      sql =
          "select station_id,station_desc,ep_type,area_id from t_cfg_station_info where station_type='2' and area_id like '"
              + area_id
              + "%' order by area_id,station_desc";
      gasStationList = f.query(cn, sql, null);

      // System.out.println(sql);

      sql = "select area_id,area_name from t_cfg_area";
      areaMap = f.getMap(cn, sql);

      // System.out.println(sql);
      num = waterStationList.size();
      for (i = 0; i < num; i++) {
        m = (Map) waterStationList.get(i);
        area_id = (String) m.get("area_id");
        m.put("area_name", areaMap.get(area_id));
      }

      num = gasStationList.size();
      for (i = 0; i < num; i++) {
        m = (Map) gasStationList.get(i);
        area_id = (String) m.get("area_id");
        m.put("area_name", areaMap.get(area_id));
      }

      // System.out.println("before close,cn="+cn);
      f.close(cn);
      // System.out.println("after close,cn="+cn);

      int waterOnlineNum, gasOnlineNum, onlineNum = 0;
      int waterOfflineNum, gasOfflineNum, offlineNum = 0;
      int waterOfflineNumNation, gasOfflineNumNation, offlineNumNation = 0;
      int waterZeroNum, gasZeroNum, zeroNum = 0;
      int waterZeroNumNation, gasZeroNumNation, zeroNumNation = 0;

      waterOnlineNum = OnlineReport.getOnlineNum(waterStationList, data);
      gasOnlineNum = OnlineReport.getOnlineNum(gasStationList, data);
      onlineNum = waterOnlineNum + gasOnlineNum;

      // System.out.println(onlineNum);

      waterOfflineNum = OnlineReport.getOfflineNum(waterStationList, data);
      gasOfflineNum = OnlineReport.getOfflineNum(gasStationList, data);
      offlineNum = waterOfflineNum + gasOfflineNum;

      // System.out.println("zeroNumNation "+zeroNumNation);

      waterOfflineNumNation = OnlineReport.getOfflineNumNation(waterStationList, data);
      gasOfflineNumNation = OnlineReport.getOfflineNumNation(gasStationList, data);
      offlineNumNation = waterOfflineNumNation + gasOfflineNumNation;

      // System.out.println("offlineNumNation "+offlineNumNation);

      waterZeroNum = OnlineReport.getZeroNum(waterStationList, data, cod_col);
      gasZeroNum = OnlineReport.getZeroNum(gasStationList, data, so2_col);
      zeroNum = waterZeroNum + gasZeroNum;

      // System.out.println(zeroNum);

      waterZeroNumNation = OnlineReport.getZeroNumNation(waterStationList, data, cod_col);
      gasZeroNumNation = OnlineReport.getZeroNumNation(gasStationList, data, so2_col);
      zeroNumNation = waterZeroNumNation + gasZeroNumNation;

      // System.out.println(zeroNumNation);

      bean.put("waterOnlineNum", waterOnlineNum + "");
      bean.put("gasOnlineNum", gasOnlineNum + "");
      bean.put("onlineNum", onlineNum + "");

      bean.put("waterOfflineNum", waterOfflineNum + "");
      bean.put("gasOfflineNum", gasOfflineNum + "");
      bean.put("offlineNum", offlineNum + "");

      bean.put("waterOfflineNumNation", waterOfflineNumNation + "");
      bean.put("gasOfflineNumNation", gasOfflineNumNation + "");
      bean.put("offlineNumNation", offlineNumNation + "");

      bean.put("waterZeroNum", waterZeroNum + "");
      bean.put("gasZeroNum", gasZeroNum + "");
      bean.put("zeroNum", zeroNum + "");

      bean.put("waterZeroNumNation", waterZeroNumNation + "");
      bean.put("gasZeroNumNation", gasZeroNumNation + "");
      bean.put("zeroNumNation", zeroNumNation + "");

      req.setAttribute("bean", bean);

      list = getOfflineList(waterStationList, data);
      req.setAttribute("waterOfflineList", list);

      list = getOfflineList(gasStationList, data);
      req.setAttribute("gasOfflineList", list);

      list = getOfflineListNation(waterStationList, data);
      req.setAttribute("waterOfflineListNation", list);

      list = getOfflineListNation(gasStationList, data);
      req.setAttribute("gasOfflineListNation", list);

      list = getZeroListNation(waterStationList, data, cod_col);
      req.setAttribute("waterZeroListNation", list);

      list = getZeroListNation(gasStationList, data, so2_col);
      req.setAttribute("gasZeroListNation", list);

    } catch (Exception e) {
      throw e;
    } finally {
      f.close(cn);
    }
  }
示例#29
0
  /**
   * 查询处理
   *
   * @param actionForm ActionForm 表单From
   * @param request HttpServletRequest Web请求
   * @param response HttpServletResponse Web结果
   * @throws CDealException 处理异常
   */
  public static void doQuery(
      QueryForm pQueryForm, HttpServletRequest request, HttpServletResponse response)
      throws CDealException {
    try {

      // 查询数据SQL语句
      String msSql =
          "select CHENGPIID,COMPLAINEDPERSON,COMPLAINPERSON,COMPLAINVERSION,to_char(a.CREATEDATE,'yyyy-mm-dd')CREATEDATE,COMPLAINUNIT,COMPLAINEDUNIT,SPARE1,SPARE2,SPARE3,SPARE4,t.abbrname,a.XZGCXYFL,a.SUBXZGCXYFL from T_YW_ZDSX_JCJ_TSCHENGPIBIAO a,t_Sys_Department t  WHERE a.STATUS = 1 and SUBMITSTATUS = 1 and t.id=COMPLAINEDUNIT "; // 主查询语句
      String msOrder = "ORDER BY CREATEDATE desc"; // 排序语句

      // 查询子条件
      String msSqlWhere = "";
      String msTemp = pQueryForm.getCHENGPIID(); // 呈批表编号
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and CHENGPIID like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getCOMPLAINEDPERSON(); // 呈批表被投诉人姓名
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and COMPLAINEDPERSON like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getCOMPLAINUNIT(); // 呈批表问题性质
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and COMPLAINUNIT like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getCOMPLAINEDUNIT(); // 呈批表被投诉人单位
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and COMPLAINEDUNIT = '" + msTemp + "'";
      }
      msTemp = pQueryForm.getCOMPLAINPERSON(); // 呈批表投诉人姓名
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and COMPLAINPERSON like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getCOMPLAINVERSION(); // 呈批表投诉形式
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and COMPLAINVERSION =" + msTemp;
      }
      msTemp = pQueryForm.getCREATEDATE1(); // 呈批表创建时间,起
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and CREATEDATE >= to_date('" + msTemp + "','yyyy-mm-dd')";
      }
      msTemp = pQueryForm.getCREATEDATE2(); // 呈批表创建时间,止
      if (msTemp != null && msTemp.length() > 0) {
        msSqlWhere += " and CREATEDATE <= to_date('" + msTemp + "','yyyy-mm-dd')";
      }

      msSql = msSql + msSqlWhere; // 主查询语句 加上 查询子条件

      CDataPage dataPage = new CDataPage(); // 翻页实现类
      dataPage.setQuerySql(msSql); // 设置查询语句
      dataPage.setOrderStr(msOrder); // 设置排序语句
      dataPage.setPageRowCount(CConstants.PAGE_ROW_COUNT); // 每页行数
      dataPage.init(request);
      request.setAttribute(CConstants.DATA_PAGE_OBJECT, dataPage);

      // 初始化页面,初始化投诉形式下拉菜单
      TreeMap COMPLAINVERSIONListName = new TreeMap(); // 取出aWebForm
      COMPLAINVERSIONListName = CCodeMap.getMapByType("行政效能投诉形式");
      pQueryForm.setCOMPLAINVERSIONList(COMPLAINVERSIONListName);
      TreeMap COMPLAINVERSIONListName1 = new TreeMap(); // 取出aWebForm
      COMPLAINVERSIONListName1 = CCodeMap.getMapByType("部门名称列表");
      pQueryForm.setDepartList(COMPLAINVERSIONListName1);

    } catch (Exception e) {
      throw new CDealException("根据输入条件进行查询时失败。", e);
    }
  }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");
      out.write("\r\n\r\n");

      String strIp = (String) request.getParameter("ip");
      String strCommunityString = (String) request.getParameter("cs");
      String strPort = (String) request.getParameter("port");
      String strTimeout = (String) request.getParameter("timeout");
      String strRetries = (String) request.getParameter("retries");
      String strNodeLabel = (String) request.getParameter("node");
      String strNodeId = request.getParameter("nodeId");
      String strFirstTime = (String) request.getParameter("firsttime");
      String strWindowId = (String) request.getParameter("windowid");

      // Create the querier and make the request.
      QueryFactory factory = new QueryFactory();
      Querier querier = (Querier) factory.createQuerier(WinPagePerfSnmpQuerier.QUERIER_NAME);
      DeviceCommunicator deviceCommunicator = new DeviceCommunicator();
      deviceCommunicator.sendQuery(querier, strIp);

      // Error processing
      if (querier.getErrorStatus() == -1) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpCommError");
        rd.forward(request, response);
        return;
      }
      if (querier.getErrorStatus() == -2) {
        RequestDispatcher rd =
            getServletContext()
                .getRequestDispatcher("/jsp/WTerror-handler.jsp?error=NoPerfmibSnmpError");
        rd.forward(request, response);
        return;
      }

      if (querier.getErrorStatus() != 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Map calcs = querier.getCalculations();
      long[] results = (long[]) calcs.get(WinPagePerfSnmpQuerier.PAGE_RESULTS);

      if (results[0] < 0
          || results[1] < 0
          || results[2] < 0
          || results[3] < 0
          || results[4] < 0
          || results[5] < 0
          || results[6] < 0
          || results[7] < 0
          || results[8] < 0
          || results[9] < 0) {
        RequestDispatcher rd =
            getServletContext().getRequestDispatcher("/jsp/WTerror-handler.jsp?error=SnmpError");
        rd.forward(request, response);
        return;
      }

      Vector vPageStats = null;

      if (strFirstTime == null) {
        // Not the first time, so get the previous polled data from the session
        vPageStats = (Vector) session.getAttribute("vPageStats" + strWindowId);
      } else {
        // This is the first time in this JSP, so create the Vector which will contain the
        // polled data
        Random random = new Random();
        strWindowId = String.valueOf(random.nextInt());

        vPageStats = new Vector();
      }

      vPageStats.add(results);
      session.setAttribute("vPageStats" + strWindowId, vPageStats);

      // This random number is used to prevent the brower from caching the IMG tags
      Random random = new Random();
      int randomInt = random.nextInt();

      out.write("\r\n\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n  ");
      out.write("<title>WebTelemetry - Graphs | Real-Time | Windows Page Performance Monitoring");
      out.write("</title>\r\n  ");
      out.write("<META HTTP-EQUIV=\"refresh\" CONTENT=\"");
      out.print(WTProperties.getMonitorUIRefreshRate());
      out.write("; URL=");
      out.print(WTTools.getJspURL(request));
      out.write("WTwin-page-monitor.jsp?cs=");
      out.print(URLEncoder.encode(strCommunityString, "UTF-8"));
      out.write("&ip=");
      out.print(strIp);
      out.write("&port=");
      out.print(strPort);
      out.write("&timeout=");
      out.print(strTimeout);
      out.write("&retries=");
      out.print(strRetries);
      out.write("&node=");
      out.print(URLEncoder.encode(strNodeLabel, "UTF-8"));
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("&nodeId=");
      out.print(strNodeId);
      out.write("\">\r\n  ");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\r\n  ");
      out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">");
      out.write("</script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      String title =
          "Graphs - Real-Time - Windows Page Performance Monitoring for Node: " + strNodeLabel;
      out.write("\r\n");
      request.setAttribute("title", title);
      request.setAttribute("nodeJsp", "/wt-monitor/element/node.jsp?node=" + strNodeId);
      out.write("\r\n");
      /* ----  c:import ---- */
      org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_0 =
          (org.apache.taglibs.standard.tag.el.core.ImportTag)
              _jspx_tagPool_c_import_url_context.get(
                  org.apache.taglibs.standard.tag.el.core.ImportTag.class);
      _jspx_th_c_import_0.setPageContext(pageContext);
      _jspx_th_c_import_0.setParent(null);
      _jspx_th_c_import_0.setContext("/wt-monitor");
      _jspx_th_c_import_0.setUrl("/includes/header.jsp");
      int[] _jspx_push_body_count_c_import_0 = new int[] {0};
      try {
        int _jspx_eval_c_import_0 = _jspx_th_c_import_0.doStartTag();
        if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
          if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
            javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
            _jspx_push_body_count_c_import_0[0]++;
            out = _bc;
            _jspx_th_c_import_0.setBodyContent(_bc);
            _jspx_th_c_import_0.doInitBody();
          }
          do {
            out.write("\r\n\t");
            if (_jspx_meth_c_param_0(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_1(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n\t");
            if (_jspx_meth_c_param_2(
                _jspx_th_c_import_0, pageContext, _jspx_push_body_count_c_import_0)) return;
            out.write("\r\n");
            int evalDoAfterBody = _jspx_th_c_import_0.doAfterBody();
            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break;
          } while (true);
          if (_jspx_eval_c_import_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
            out = pageContext.popBody();
          _jspx_push_body_count_c_import_0[0]--;
        }
        if (_jspx_th_c_import_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } catch (Throwable _jspx_exception) {
        while (_jspx_push_body_count_c_import_0[0]-- > 0) out = pageContext.popBody();
        _jspx_th_c_import_0.doCatch(_jspx_exception);
      } finally {
        _jspx_th_c_import_0.doFinally();
        _jspx_tagPool_c_import_url_context.reuse(_jspx_th_c_import_0);
      }
      out.write("\t\r\n\t");
      out.write("\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"20\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagefaultseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumchart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagenumseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n\t");
      out.write("<tr>\r\n\t\t");
      out.write("<td align=\"right\">");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimeschart&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t\t");
      out.write("<td>&nbsp;");
      out.write("</td>\r\n\t\t");
      out.write("<td>");
      out.write("<IMG SRC=\"");
      out.print(WTTools.getServletURL(request));
      out.write("WTsnmpRealTimeGraphs?chart=winpagetimesseries&random=");
      out.print(randomInt);
      out.write("&windowid=");
      out.print(strWindowId);
      out.write("\" BORDER=0>");
      out.write("</td>\r\n\t");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("</div>\r\n");
      out.write("<br>\r\n\r\n");
      /* ----  c:import ---- */
      org.apache.taglibs.standard.tag.el.core.ImportTag _jspx_th_c_import_1 =
          (org.apache.taglibs.standard.tag.el.core.ImportTag)
              _jspx_tagPool_c_import_url_context_nobody.get(
                  org.apache.taglibs.standard.tag.el.core.ImportTag.class);
      _jspx_th_c_import_1.setPageContext(pageContext);
      _jspx_th_c_import_1.setParent(null);
      _jspx_th_c_import_1.setContext("/wt-monitor");
      _jspx_th_c_import_1.setUrl("/includes/footer.jsp");
      int[] _jspx_push_body_count_c_import_1 = new int[] {0};
      try {
        int _jspx_eval_c_import_1 = _jspx_th_c_import_1.doStartTag();
        if (_jspx_th_c_import_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } catch (Throwable _jspx_exception) {
        while (_jspx_push_body_count_c_import_1[0]-- > 0) out = pageContext.popBody();
        _jspx_th_c_import_1.doCatch(_jspx_exception);
      } finally {
        _jspx_th_c_import_1.doFinally();
        _jspx_tagPool_c_import_url_context_nobody.reuse(_jspx_th_c_import_1);
      }
      out.write("\r\n\t\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }