File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage value while downloading .doc through JSP

 
akshay khopkar
Greenhorn
Posts: 5
  • 0
  • 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: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic