@Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        String acao = request.getParameter("acao");
        
        try {
            if (acao.equals("sa")) {
                String sa = request.getParameter("sa_str");
                ArrayList lista2 = new ArrayList();
                lista2 = jAssistec2.getATSA(sa);
                request.setAttribute("lista", lista2);
                request.getRequestDispatcher("SerialResumo.jsp").forward(request, response);
                processRequest(request, response);
            } else {
                boolean isMultipart = ServletFileUpload.isMultipartContent(request);
                if (isMultipart) {

                    FileItemFactory factory = new DiskFileItemFactory();
                    ServletFileUpload upload = new ServletFileUpload(factory);

                    List items = null;
                    items = upload.parseRequest(request);
                    Iterator iter = items.iterator();
                    while (iter.hasNext()) {
                        FileItem item = (FileItem) iter.next();
                        if (item.isFormField()) {
                        } else {
                            //byte[] arquivo = item.get();
                            //for (byte b : arquivo ) {
                            //System.out.println(item.getString());
                            //   }

                            ArrayList lista1 = new ArrayList();
                            //           ArrayList lista2 = new ArrayList();

                            String[] str = item.getString().split("\n");
                            for (String a : str) {
                                // System.out.print(a);
                                //a.replaceAll("\t"," ").replaceAll("\r\n", " ").replaceAll("\n", " ").trim();  
                                a = a.replaceAll("\r", " ").replaceAll("\r\n", " ").replaceAll("\n", " ").trim();
                                lista1.add("\n------------------------------------------------------------------------------------------------------------------------------------------------------");
                                lista1.add(a);

                                if (acao.equals("assistec")) {
                                    lista1.addAll(jConsultaWeb.getSerialResumoAssis(a));
                                } else {

                                    lista1.addAll(jConsultaWeb.getSerialResumo(a));
                                }
                                //lista2.addAll(lista1);
                            }
                            request.setAttribute("lista", lista1);
                            request.getRequestDispatcher("SerialResumo.jsp").forward(request, response);
                        }
                    }
                    processRequest(request, response);
                }
            }
        } catch (SQLException ex) {
            Logger.getLogger(serialArquivo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(serialArquivo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (FileUploadException ex) {
            Logger.getLogger(serialArquivo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }