• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

upload in jsp

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Master Rancher
Posts: 43045
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this entry in our Servlets FAQ.
 
Avishek Kar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67694
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic