List of usage examples for org.apache.commons.fileupload FileItem isInMemory
boolean isInMemory();
From source file:org.rhq.coregui.server.gwt.FileUploadServlet.java
protected File forceToFile(FileItem fileItem) throws IOException, ServletException { if (fileItem.isInMemory()) { String name = fileItem.getName(); if (null == name) { throw new IllegalArgumentException("FileItem has null name"); }/*from ww w. j a va 2 s.c o m*/ // some browsers (IE, Chrome) pass an absolute filename, we just want the name of the file, no paths name = name.replace('\\', '/'); if (name.length() > 2 && name.charAt(1) == ':') { name = name.substring(2); } name = new File(name).getName(); File tmpFile = File.createTempFile(name, null); try { fileItem.write(tmpFile); return tmpFile; } catch (Exception e) { throw new ServletException("Failed to persist uploaded file to disk", e); } } else { return ((DiskFileItem) fileItem).getStoreLocation(); } }
From source file:org.sc.probro.servlets.IndexCreatorServlet.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try {//from www .j a v a2s .c o m OBOParser parser = null; Map<String, String[]> params = decodedParams(request); UserCredentials creds = new UserCredentials(); String ontologyName = null; boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart) { throw new BrokerException(HttpServletResponse.SC_BAD_REQUEST, "No multipart form data."); } try { File repository = new File(System.getProperty("java.io.tmpdir")); // Create a factory for disk-based file items //DiskFileItemFactory factory = new DiskFileItemFactory(); DiskFileItemFactory factory = newDiskFileItemFactory(getServletContext(), repository); // Set factory constraints factory.setSizeThreshold(10 * MB); //factory.setRepository(yourTempDirectory); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); upload.setSizeMax(50 * MB); // Parse the request List<FileItem> items = upload.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { String formName = item.getFieldName(); String formValue = item.getString(); Log.info(String.format("%s=%s", formName, formValue)); if (formName.equals("ontology_name")) { ontologyName = formValue; } } else { String formName = item.getFieldName(); String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); long sizeInBytes = item.getSize(); if (formName.equals("ontology_file")) { Log.info(String.format("fileName=%s, contentType=%s, size=%d", fileName, contentType, sizeInBytes)); if (fileName.length() > 0) { InputStream uploadedStream = item.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(uploadedStream)); parser = new OBOParser(); parser.parse(reader); reader.close(); } } else { Log.warn(String.format("unknown file: %s", formName)); } } } } catch (IOException e) { throw new BrokerException(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } catch (FileUploadException e) { throw new BrokerException(e); } if (ontologyName == null) { throw new BadRequestException("No ontology_name field given."); } OBOOntology ontology = null; try { if (parser != null) { Log.info(String.format("Retrieving OBO ontology from file.")); // file was uploaded ontology = parser.getOntology(); } else { // try to get it from teh sparql endpoint Log.info(String.format("No OBO file uploaded, reading from Sparql endpoint instead.")); OBOBuilder builder = new OBOBuilder(oboSparql); ontology = builder.buildOntology(ontologyName); } } catch (IOException e) { throw new BrokerException(e); } Broker broker = getBroker(); try { Ontology ont = broker.createOntology(creds, ontologyName, ontology); response.setStatus(HttpServletResponse.SC_OK); response.setContentType("text"); response.getWriter().print(ont.id); } finally { broker.close(); } } catch (BrokerException e) { handleException(response, e); return; } }
From source file:org.tolven.ajax.DocServlet.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(4096);//w ww.j a v a2 s. co m // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); Writer writer = response.getWriter(); // Parse the request String returnTo = null; try { List<FileItem> items = upload.parseRequest(request); long id = 0; for (FileItem item : items) { if (item.isFormField()) { String name = item.getFieldName(); String value = item.getString(); if ("returnTo".equals(name)) returnTo = value; } else { String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); // TODO less than int bytes int sizeInBytes = (int) item.getSize(); AccountUser accountUser = TolvenRequest.getInstance().getAccountUser(); DocBase doc = docBean.createNewDocument(contentType, "", accountUser); // Get the logged in user and set as the author Object obj = request.getSession().getAttribute(GeneralSecurityFilter.ACCOUNT_ID); if (obj == null) throw new IllegalStateException(getClass() + ": Session ACCOUNT_ID is null"); obj = request.getSession().getAttribute(GeneralSecurityFilter.TOLVENUSER_ID); if (obj == null) throw new IllegalStateException(getClass() + ": Session TOLVENUSER_ID is null"); String kbeKeyAlgorithm = propertyBean.getProperty(DocumentSecretKey.DOC_KBE_KEY_ALGORITHM_PROP); int kbeKeyLength = Integer .parseInt(propertyBean.getProperty(DocumentSecretKey.DOC_KBE_KEY_LENGTH)); if (isInMemory) { doc.setAsEncryptedContent(item.get(), kbeKeyAlgorithm, kbeKeyLength); } else { InputStream uploadedStream = item.getInputStream(); byte[] b = new byte[sizeInBytes]; uploadedStream.read(b); doc.setAsEncryptedContent(b, kbeKeyAlgorithm, kbeKeyLength); uploadedStream.close(); } docBean.finalizeDocument(doc); } // writer.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html>\n" + writer.write("<html>\n" + "<head>" + (returnTo == null ? " " : "<meta http-equiv=\"refresh\" content=\"0; url=" + returnTo + "\"/>") + "</head><body>\n" + id + "\n</body>\n</html>\n"); } } catch (FileUploadException e) { response.sendError(HttpServletResponse.SC_BAD_REQUEST); e.printStackTrace(); } finally { request.setAttribute("activeWriter", writer); // writer.close(); } }
From source file:org.tolven.web.MenuAction.java
/** * Add an attachment to the current menudataItem * @return success//from w w w .j ava 2 s . com * @throws Exception */ public String addAttachment() throws Exception { HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() .getRequest(); FileItem upfile = (FileItem) request.getAttribute("upfile"); if (upfile == null) return "fail"; String contentType = upfile.getContentType(); TolvenLogger.info("Upload, contentType: " + contentType, MenuAction.class); boolean isInMemory = upfile.isInMemory(); int sizeInBytes = (int) upfile.getSize(); DocBase doc = getDocumentLocal().createNewDocument(contentType, getAttachmentType(), TolvenRequest.getInstance().getAccountUser()); doc.setSchemaURI(getAttachmentType()); byte[] b; if (isInMemory) { b = upfile.get(); } else { InputStream uploadedStream = upfile.getInputStream(); b = new byte[sizeInBytes]; uploadedStream.read(b); uploadedStream.close(); } String kbeKeyAlgorithm = getTolvenPropertiesBean() .getProperty(DocumentSecretKey.DOC_KBE_KEY_ALGORITHM_PROP); int kbeKeyLength = Integer .parseInt(getTolvenPropertiesBean().getProperty(DocumentSecretKey.DOC_KBE_KEY_LENGTH)); doc.setAsEncryptedContent(b, kbeKeyAlgorithm, kbeKeyLength); getDocBean().createFinalDocument(doc); getDocumentLocal().createAttachment(getDrilldownItemDoc(), doc, getAttachmentDescription(), TolvenRequest.getInstance().getAccountUser(), getNow()); setAttachmentDescription(null); return "success"; }
From source file:podd.resources.TabImportResource.java
@Override @Post("html")//w ww.ja va2s.co m protected Representation doAuthenticatedPost(Representation entity, Variant variant) throws ResourceException { Representation resultRepresentation = null; boolean validformdata = false; if (_DEBUG) { LOGGER.debug("mediaType: " + entity.getMediaType().getName()); } if (entity.getMediaType().getName().equals(MediaType.APPLICATION_WWW_FORM.getName())) { validformdata = formHandler.saveForm(this.getRequest().getEntityAsForm()); } else { validformdata = formHandler.saveFieldValues(entity); } if (_DEBUG) { LOGGER.debug("validFormData: " + validformdata); } boolean hasError = false; if (validformdata) { try { // add currently selected file to the Map of files to be attached when PODD object is saved formHandler.addFile(false); String submitAction = formHandler.getFirstFieldValue(INPUT_ACTION); if (_DEBUG) { LOGGER.debug("submitAction: " + submitAction); } if (submitAction != null && submitAction.trim().length() != 0) { if (submitAction.equals(ACTION_SUBMIT)) {// Submitting // Store all the parameters in a Tab object Tab tab = new Tab(); for (Iterator<FileItem> it = formHandler.getFileIterator(); it.hasNext();) { FileItem item = it.next(); if (_DEBUG) { LOGGER.debug("adding file name: " + item.getName() + " fieldName: " + item.getFieldName() + " in memory: " + item.isInMemory()); } DiskFileItem diskFileItem = (DiskFileItem) item; if (!item.getFieldName().equals(INPUT_TAB_FILE)) { // If the file is not on disk, force to disk File copiedFile = FileUploadHelper.writeToDisk(diskFileItem, authenticatedUser); if (copiedFile != null) { if (copiedFile.exists()) tab.addAttachment(copiedFile.getName(), copiedFile); else { String msg = "File attachment failed to copy: " + copiedFile.getAbsolutePath(); LOGGER.error(msg); auditLogHelper.auditAction(ERROR, authenticatedUser, "TAB Import Resource: " + msg, ""); throw new ResourceException(new PoddTabException(msg)); } } } else { tab.setTabStream(item.getInputStream()); } } tabImporter = TabImporterFactory.getInstance().createTabImporter(this.getRequest(), tab); // Run in a separate thread so that we can get a response back right away Thread t = new Thread() { public void run() { // Now that we have all the parameters, import the TAB file try { tabImporter.importTab(); } catch (PoddTabException e) { LOGGER.error("Found PODD Tab exception", e); tabImporter.rollbackCreatedObjects(); } catch (PoddWebServiceException e) { LOGGER.error("Found PODD Web Service exception", e); tabImporter.rollbackCreatedObjects(); } formHandler.resetAllFields(); } }; t.start(); // Hack: so that Javascript can invoke the redirection in the Freemarker templates /* try { Thread.sleep(4000); } catch (InterruptedException e) { LOGGER.error(e); e.printStackTrace(); }*/ // Return back to the same page and indicate that the page should check the status of the import /* String redirectUrl = this.getRequest().getOriginalRef().toString() + "?" + INPUT_ACTION + "=" + GET_ACTION_COMPLETED; LOGGER.debug("redirectUrl: " + redirectUrl); getResponse().redirectPermanent(redirectUrl); return super.doAuthenticatedGet(variant); */ // Indicate to the page that the tab file has been submitted dataModel.put("submitted", Boolean.TRUE); resultRepresentation = getMainFormRepresentation(variant); } else if (submitAction.equals(ACTION_RESET)) { tabImporter.reset(); formHandler.resetAllFields(); resultRepresentation = get(variant); } else if (submitAction.equals(ACTION_CACHE_TAB_FILE)) { resultRepresentation = doAuthenticatedGet(variant); } else { resultRepresentation = doAuthenticatedGet(variant); } } else if (formHandler.fieldExists("removeFile")) { formHandler.removeFile(); resultRepresentation = doAuthenticatedGet(variant); } else { // File attachment most likely resultRepresentation = doAuthenticatedGet(variant); } } catch (IOException e) { final String msg = "Exception reading file item: " + e.getMessage(); exceptionHandler.handleException(e, true, msg); auditLogHelper.auditAction(ERROR, authenticatedUser, "TAB Import Resource: " + msg, e.toString()); hasError = true; } // If there's an error go back to the originating page if (hasError) { LOGGER.error("There was an error. Redirecting to originating page to display error messages"); // Rollback tabImporter.rollbackCreatedObjects(); resultRepresentation = getMainFormRepresentation(variant); } } if (_DEBUG) { LOGGER.debug("resultRepresentation: " + resultRepresentation); } return resultRepresentation; }
From source file:rva.administrator.ASRepFileUpload.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { // Check that we have a file upload request isMultipart = ServletFileUpload.isMultipartContent(request); response.setContentType("text/html"); java.io.PrintWriter out = response.getWriter(); if (!isMultipart) { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); out.println("<p>No file uploaded</p>"); out.println("</body>"); out.println("</html>"); return;// w w w . j a v a 2s .co m } DiskFileItemFactory factory = new DiskFileItemFactory(); // maximum size that will be stored in memory factory.setSizeThreshold(maxMemSize); // Location to save data that is larger than maxMemSize. factory.setRepository(new File("c:\\temp")); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // maximum file size to be uploaded. upload.setSizeMax(maxFileSize); try { // Parse the request to get file items. List fileItems = upload.parseRequest(request); // Process the uploaded file items Iterator i = fileItems.iterator(); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); if (!fi.isFormField()) { // Get the uploaded file parameters String fieldName = fi.getFieldName(); String fileName = fi.getName(); String contentType = fi.getContentType(); boolean isInMemory = fi.isInMemory(); long sizeInBytes = fi.getSize(); // Write the file if (fileName.lastIndexOf("\\") >= 0) { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\"))); } else { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\") + 1)); } fi.write(file); String upfile = filePath + fileName; ReadExcels.readExcels(upfile); out.println("<html>"); out.println("<body>"); HttpSession session = request.getSession(); response.sendRedirect("fileuploading.jsp"); session.setAttribute("filepathas", upfile); // RequestDispatcher rd=request.getRequestDispatcher("fileuploading.jsp"); // rd.include(request, response); //out.println("Uploaded Filename:" +upfile+ "<br>"); out.println("</body>"); out.println("</html>"); } } out.println("</body>"); out.println("</html>"); } catch (Exception ex) { System.out.println(ex); } }
From source file:rva.administrator.DTTRepFileUpload.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { // Check that we have a file upload request isMultipart = ServletFileUpload.isMultipartContent(request); response.setContentType("text/html"); java.io.PrintWriter out = response.getWriter(); if (!isMultipart) { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); out.println("<p>No file uploaded</p>"); out.println("</body>"); out.println("</html>"); return;//w w w . j a v a2 s . co m } DiskFileItemFactory factory = new DiskFileItemFactory(); // maximum size that will be stored in memory factory.setSizeThreshold(maxMemSize); // Location to save data that is larger than maxMemSize. factory.setRepository(new File("c:\\temp")); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // maximum file size to be uploaded. upload.setSizeMax(maxFileSize); try { // Parse the request to get file items. List fileItems = upload.parseRequest(request); // Process the uploaded file items Iterator i = fileItems.iterator(); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); if (!fi.isFormField()) { // Get the uploaded file parameters String fieldName = fi.getFieldName(); String fileName = fi.getName(); String contentType = fi.getContentType(); boolean isInMemory = fi.isInMemory(); long sizeInBytes = fi.getSize(); // Write the file if (fileName.lastIndexOf("\\") >= 0) { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\"))); } else { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\") + 1)); } fi.write(file); String upfile = filePath + fileName; new ReadDttReport().readDTTReport(upfile); out.println("<html>"); out.println("<body>"); HttpSession session = request.getSession(); response.sendRedirect("dttreportfileupload.jsp"); session.setAttribute("filepathdtt", upfile); // RequestDispatcher rd=request.getRequestDispatcher("fileuploading.jsp"); // rd.include(request, response); //out.println("Uploaded Filename:" +upfile+ "<br>"); out.println("</body>"); out.println("</html>"); } } out.println("</body>"); out.println("</html>"); } catch (Exception ex) { System.out.println(ex); } }
From source file:rva.taskinsert.RetelLog.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { // Check that we have a file upload request HttpSession session = request.getSession(); LogBean lb = (LogBean) session.getAttribute("currloginsession"); String performdate = (String) session.getAttribute("logindate"); String empname = lb.getAuditorname(); isMultipart = ServletFileUpload.isMultipartContent(request); response.setContentType("text/html"); java.io.PrintWriter out = response.getWriter(); // out.println(isMultipart); if (!isMultipart) { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); out.println("<p>No file uploaded</p>"); out.println("</body>"); out.println("</html>"); return;/*from w ww . ja va2 s. c o m*/ } DiskFileItemFactory factory = new DiskFileItemFactory(); // maximum size that will be stored in memory factory.setSizeThreshold(maxMemSize); // Location to save data that is larger than maxMemSize. factory.setRepository(new File("c:\\temp")); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // maximum file size to be uploaded. upload.setSizeMax(maxFileSize); try { // Parse the request to get file items. List fileItems = upload.parseRequest(request); // Process the uploaded file items Iterator i = fileItems.iterator(); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet upload</title>"); out.println("</head>"); out.println("<body>"); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); if (!fi.isFormField()) { // Get the uploaded file parameters String fieldName = fi.getFieldName(); String fileName = fi.getName(); String contentType = fi.getContentType(); boolean isInMemory = fi.isInMemory(); long sizeInBytes = fi.getSize(); // Write the file if (fileName.lastIndexOf("\\") >= 0) { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\"))); } else { file = new File(filePath + fileName.substring(fileName.lastIndexOf("\\") + 1)); } fi.write(file); String upfile = filePath + fileName; RetFileRead.readExcels(upfile, empname, performdate); out.println("<html>"); out.println("<body>"); //HttpSession session=request.getSession(); response.sendRedirect("reteltaskinsert.jsp"); session.setAttribute("filepathret", upfile); // RequestDispatcher rd=request.getRequestDispatcher("fileuploading.jsp"); // rd.include(request, response); //out.println("Uploaded Filename:" +upfile+ "<br>"); out.println("</body>"); out.println("</html>"); } } out.println("File3"); out.println("</body>"); out.println("</html>"); } catch (Exception ex) { System.out.println(ex); } }
From source file:se.tillvaxtverket.ttsigvalws.ttwebservice.TTSigValServlet.java
private void processFileUpload(HttpServletRequest request, HttpServletResponse response) { // Create a factory for disk-based file items Map<String, String> paraMap = new HashMap<String, String>(); File uploadedFile = null;/*w ww . ja va2s .c om*/ boolean uploaded = false; DiskFileItemFactory factory = new DiskFileItemFactory(); File storageDir = new File(baseModel.getConf().getDataDirectory() + "/uploads"); if (!storageDir.exists()) { storageDir.mkdirs(); } factory.setRepository(storageDir); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); try { // Parse the request List<FileItem> items = upload.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { String name = item.getFieldName(); String value = item.getString(); paraMap.put(name, value); } else { String fieldName = item.getFieldName(); String fileName = item.getName(); String contentType = item.getContentType(); boolean isInMemory = item.isInMemory(); long sizeInBytes = item.getSize(); uploadedFile = new File(storageDir, fileName); try { item.write(uploadedFile); uploaded = true; } catch (Exception ex) { } } } if (uploaded && paraMap.containsKey("policy")) { String verifyResult = verifySignature(request, paraMap.get("policy"), uploadedFile.getName(), uploadedFile.getAbsolutePath(), null); sendValidationReport(verifyResult, response); return; } if (paraMap.containsKey("policy") && paraMap.containsKey("fileName")) { File sigFile = new File(getFullSigFileName(paraMap.get("fileName"))); String verifyResult = verifySignature(request, paraMap.get("policy"), sigFile.getName(), sigFile.getAbsolutePath(), null); sendValidationReport(verifyResult, response); return; } } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } nullResponse(response); }
From source file:Servlet.UploadServlet.java
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request/*from ww w .j a v a 2 s . com*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession tempSession = request.getSession(); java.lang.System.out.println(tempSession.getAttribute("accountType") + "---------------upload\n"); if (tempSession.getAttribute("accountType") == null || !tempSession.getAttribute("accountType").equals("2")) { response.sendRedirect("login.jsp"); } else { System.out.println("------------------IN UPLOADING PROCESS------------------"); String uploader_id = "", title = "", description = "", importancy = "", category = "", fileName = "", date = ""; File file; int maxFileSize = 5000 * 1024; int maxMemSize = 5000 * 1024; String filePath = "G:\\GoogleDrive\\Class file\\Current\\Me\\Web\\Lab\\Project\\Web Project\\ENotice\\src\\main\\webapp\\files\\"; String contentType = request.getContentType(); if ((contentType.indexOf("multipart/form-data") >= 0)) { DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(maxMemSize); factory.setRepository(new File("C:\\temp\\")); ServletFileUpload upload = new ServletFileUpload(factory); upload.setSizeMax(maxFileSize); try { List fileItems = upload.parseRequest(request); Iterator i = fileItems.iterator(); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); if (!fi.isFormField()) { String fieldName = fi.getFieldName(); fileName = fi.getName(); boolean isInMemory = fi.isInMemory(); long sizeInBytes = fi.getSize(); file = new File(filePath + fileName); fi.write(file); } else if (fi.getFieldName().equals("title")) { title = fi.getString(); } else if (fi.getFieldName().equals("description")) { description = fi.getString(); } else if (fi.getFieldName().equals("importancy")) { importancy = fi.getString(); } else { category = fi.getString(); } } } catch (Exception ex) { System.out.println(ex); } } else { } //transfering data to Upload notice try { String uploaderId = (String) tempSession.getAttribute("id"); System.out.println("id : " + uploaderId); System.out.println(title + " " + description + " " + importancy + " " + category + " " + fileName + " " + uploaderId); Upload upload = new Upload(); upload.upload(uploaderId, title, description, importancy, category, fileName); } catch (Exception e) { System.out.println("Exception in doPost of UploadServlet()"); e.printStackTrace(); } if (request.getAttribute("fromEdit") == null) { //back to upload.jsp System.out.println("fromEdit is null!!!"); System.out.println("position of Notice : " + request.getParameter("positionOfNotice")); response.sendRedirect("upload.jsp"); } else { System.out.println("fromEdit is not null!!!"); RequestDispatcher rd = request.getRequestDispatcher("UploaderNextPrevCombo"); rd.forward(request, response); } } }