• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage value while downloading .doc through JSP

 
akshay khopkar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to upload and download documents in DB through JSP. For this purpose I use a table with BLOB data type and store byte array in it. Problem is, code is working fine for pdf, txt and jpeg. But in the case of .doc a document with lots of garbage character is getting generated.

To pin point the problem, I removed the part, which was used to store and retrieve byte array from DB. Now I am trying to write byte array in output stream, in the page used to upload file itself. But still i am getting a .doc with garbage value.

My current code looks like:



Please suggest to debug..!!

Thanks :)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
akshay khopkar wrote:
I am trying to upload and download documents in DB through JSP.

That is your first mistake. JSP is unsuitable for this task. You should be using a servlet.

Please read this article ti understand why JSP is poor choice for this task.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic