File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
Read PDF File Path From Servlet. PDF is right under WebContent
Joined: Jul 21, 2003
Feb 07, 2006 15:34:00
What is the best way to read a
(or any file) from a
PDF is sitting right under WebContent directory of a Web project. Please note that PDF is not inside WEB-INF.
Servlet is under:
JavSource Directory in WSAD in a package as -
I want to get the path of the PDF file from Servlet and do file IO as:
File aFile = new File(filePathAndName);
I know the name of the file at runtime. So, I only need the file path within Servlet container.
req.getContextPath()+"/myPdf.pdf" with no luck.
I also tried:
No luck either.
What is the best way to get file path for the pdf from my servlet class?
My goal is to get a handle of the PDF file from Servlet. After I get a handle of the PDF file, I will get content of that PDF file.
Author and ninkuma
Joined: Jan 10, 2002
Feb 07, 2006 15:44:00
The context path is assumed.
[ February 07, 2006: Message edited by: Bear Bibeault ]
Asking smart questions
Books by Bear
I agree. Here's the link:
subject: Read PDF File Path From Servlet. PDF is right under WebContent
Issues w/the PDFs and Back Buttons
accessing a .properties file
Can't locate .js (or .css) files from a .jsp page.
How to know the absolute directory path of WebContent folder?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014