Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

Showing pdf files in jsp giving error  RSS feed

Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am usinhg JSP to show pdf or word files in IE browser. The files are stored as Blob in Oracle database. The following code should show the file when I run JSP, but it shows all garbage along with text of pdf file. I tried the same with another file that is stored as word after changing content type to application/windoc that also does not work. What am I doing wrong here? I did verify that file was right as I laoded them using Oracle utility.


BLOB b = ((OracleResultSet)rset).getBLOB (1);

byte[] ba = b.getBytes(1, (int)b.length());

OutputStream os = response.getOutputStream();
Bear Bibeault
Author and ninkuma
Posts: 65824
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is why you should never use a JSP to do a Servlets job. And please don't ask what is essentailly the same question more than once. Please continue any discussion in the original topic.
[ May 20, 2005: Message edited by: Bear Bibeault ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!