This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
Hi I want to download a file from JSP page the downloaded file is already in my application. URL for same file is given like response.sendRedirect("a.jsp?mFileName="+mFileName+"&mUser="+mUser+"&mpath="+directoryName); what code I have to wrie down in a.jsp file
Ko Ko Naing
posted 12 years ago
I'll write some codes that are important and neccessary to sending the binary file to the users, ok? And u have to handle the path and directory location by yourself... response.setContentType("application/jar"); File f = new File(request.getParameter("mFileName")+request.getParameter("directoryName")); byte byteArray = new byte[(int)f.length()]; FileInputStream is = new FileInputStream(f); is.read(byteArray); OutputStream os = response.getOutputStream(); os.write(byteArray); os.flush();