• Post Reply Bookmark Topic Watch Topic
  • New Topic

How To open a file in JSP

 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can I open a file, which may be of type Txt OR pdf OR jpeg, in a jsp page. I want to open this file from servlet which reads the file lying on server and forwards its output to a jsp where that file needs to be display.
I have a clue that I have to set MIMEType and other parameter. Can anyone help to get it done. Thanks a ton in advance.
Abra
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would not use a JSP at all. Set the MIME headers and write the file data to the response output stream in the servlet.
 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I set a MIME header to response. can you please provide me few lines of code for that.
Thanks
Abra
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's all here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!