• Post Reply Bookmark Topic Watch Topic
  • New Topic

displayin word/excel file using jsp  RSS feed

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have to display word/excel file using jsp

I have disaplyed the file name from the dir,bt as soon as I click the file name.. it disply in browser bad format..
I have to show this file in its original format say word/excel

I am using jsp & tomcat
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be the question du jour.

Your best bet is to create a servlet that can stream the file to the browser.
I've published a real simple one that streams files from the filesystem. It wouldn't take much effort to rework it to stream the image you've generated on the fly.
http://simple.souther.us
Look for SimpleStream.
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can serve the excel file directly as long as you have a mime type set up.

type=application/vnd.ms-excel
extension=xls

Of course the file would need to be in a location where your application server can actually "serve" the file.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, William is right. If you're just serving them up as static files, there is no need to stream them.

In Tomcat, mime types are set up in the global web.xml file located under TOMCAT_HOME/conf.

We've had a lot of people asking how to serve up dynamic content as Excel and Word files this week and conequently, I skimmed your post and jumped to the wrong conclusion.

Sorry about that.
-Ben
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!