I have written a code for writing the data of a column from database into a file
and again reading that file and displaying.
Im writing into an .html file....Now the problem is im getting the output but that output is followed by an error.....
This is the output
-----------------------------
A large number of processes are available, and can be applied to an input or a group of inputs. These processes can be chained ogether so that the output from one process is used as an input to another process. In this manner multiple processes may be applied to an input .Error 500: Server caught unhandled exception from servlet [JSP 1.2 Processor]: getCompressingOutputStream() has already been called
Im not able to find wheres the mistake....Here is the code related to it
Expand|Select|Wrap|Line Numbers
- String strPath="\\\\enggsw-061\public\\LLDatabase\\suggestions\\textfile1.html";
- response.setContentType("APPLICATION/OCTET-STREAM");
- //writing into a file
- File f=new File(strPath);
- FileOutputStream fop=new FileOutputStream(f);
- {
- if(f.exists())
- {
- String struggestion=cLessonsLearntSearchActionForm.getSuggestions();
- fop.write(strSuggestion.getBytes());
- fop.flush();
- fop.close();
- }
- else{
- some error message
- }
- }
- //reading the file
- FileInputStream fileIn = new FileInputStream(f);
- OutputStream out = response.getOutputStream();
- {
- byte[] buffer = new byte[2048];
- int bytesRead = fileIn.read(buffer);
- while (bytesRead >= 0) {
- if (bytesRead > 0)
- out.write(buffer, 0, bytesRead); bytesRead = fileIn.read(buffer);
- }
- out.flush();
- out.close();
- fileIn.close();
- }