Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we open local PDF files on jsp onclicking URL in jsp

 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am running web application on server machine.
In web application, i am creating pdf file using itext and saving it on folder c:/PdfFilepath/

I am trying to open this PDF from my web application like : http://localhost:8080/Reportgenarate/showCert.jsp

i am accessing in following fashion:
String path="file:///C:/PdfFilepath/nargi.pdf";



also try with following fashion



When i try to open it from ablove like in firefox, it shows an error like :
firefox doesn't know how to open this address because the protocol


I also installed LocalLink 0.5 add on for firefox. it doesnot work

I am awaire that commons-fileupload-1.2.2 jar is best option to upload file on the server and access it

My application require it should access from c:/PdfFilepath/nargi.pdf

any suggestion is highly appreciate


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course not. The file protocol looks for the file on the local file system. So your users would need to already have that file on their own systems. That doesn't make any sense, does it?

If you want to serve the file you'll either need to place it within the web application so that it can be addressed via URL, or write a servlet that will read the file and stream it as the response, setting the appropriate headers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic