This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes How to show file(residing on server) link on HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "How to show file(residing on server) link on HTML" Watch "How to show file(residing on server) link on HTML" New topic
Author

How to show file(residing on server) link on HTML

sonia chg
Greenhorn

Joined: Jul 02, 2010
Posts: 1
Hello,

I am generating an excel report from the Webapp. The application generates the excel file and save it on the server's home directory.

Now I need to show the link of this excel file on the HTML so that when the user clicks on that link the file should be opened.

Is there any way to show the link of the file if that file is not bundled inside the webapp and is residing on the home directory of the server? If not, then what could be the other approach to achieve the same.

Any help or pointers in this regard will be highly appreciated.

Thanks
Sonia
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1508
    
    5

May be you could create a temp file within your web context.


Swastik
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
The link could point to a servlet that streams the file to the browser. The CodeBarn has an example of how that's done. An additional benefit of that would be that the servlet could track how often the file is downloaded, or could perform access control if necessary.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to show file(residing on server) link on HTML
 
It's not a secret anymore!