• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

upload in jsp

 
Avishek Kar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to upload a .doc file in jsp and want to show that uploaded .doc file
in next page in the browser.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are not meant for this kind of thing; use a servlet instead that can handle the upload at the server side, and which then forwards the request to a JSP which can show the result. The Jakarta Commons FileUpload library can handle the file upload part.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Avishek Kar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have uploaded doc file in database and want to fetch it and show it as html
can anybody provide me the source code for the same.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Avishek Kar:
can anybody provide me the source code for the same.

JavaRanch is a learning site. As such, you write your own code with our help.

So what have you got so far?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Avishek Kar:
I have uploaded doc file in database and want to fetch it and show it as html
can anybody provide me the source code for the same.


If you mean by 'doc file' a Microsoft Word document, then you can't.
Not with JSP alone anyway.

There are third party libraries such as POI for working with Microsoft Office formats from Java. You might need to look into one of those.
If you can reasonably expect your users to have Microsoft Office or something that can work with Office files (Like Open Office), then you might consider writing a servlet that streams the document, as is, to the browser.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic