I have a PDF file in my Webcontent/dir/helpdir.pdf and in JSP page i am trying to download the PDF by calling a servlet The PDF is located in Webcontent/dir folder . But when i run the program i am getting filenot found. Please guide me . Below is the code snipet
Since i need the pdf to display a popup asking do you want to open or save i am not linking it directly.
Yes my file is inside the webapp itself
Do i need to use getservletcontext.getrealpath()
If i am wrong can you please guide me
Rudy Gireyev
Ranch Hand
Joined: May 03, 2011
Posts: 39
posted
0
Sandesh Shashidhar wrote:
I have a PDF file in my Webcontent/dir/helpdir.pdf and in JSP page i am trying to download the PDF by calling a servlet
The PDF is located in Webcontent/dir folder
Hello Sandesh. In your desription you state that the file is in the /dir directory .....
As Bear pointed out, you can give a direct link to the pdf. But when you click that link, I guess browser would automatically open a pop up and asks you, if you want to save it or open it. Can you try that and see, if mere linking works for you, if not we can think of other options.
Regards
KumarRaja
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
Sandesh Shashidhar wrote:Since i need the pdf to display a popup asking do you want to open or save i am not linking it directly.
Whether or not that dialog is shown is a browser setting. There's nothing the PDF can do about it, and very little (possibly nothing) the web app can do about it. You should accept that the user may have other ideas on how to work with files than what your web app would like him to have.