Hi,
I am creating a pdf file from a JSP page as follows:
<code>
String reportURL = "Trainee.jasper";
Map parameters = new HashMap();
Connection conn;
conn =
DriverManager.getConnection("jdbc:mysql://server/database","user","pass");
JasperRunManager.runReportToPdfFile(reportURL,"tmp.pdf",parameters,conn);
</code>
It appears to be creating the PDF file in the JBOSS/bin directory on my
local machine (I am deploying via JBoss), which it really shouldn't be
doing, since the rest of my project can't see that directory. Referring
to it using an absolute path is not an option, as this may end up being
deployed by an ISP, where I obviously wouldn't have the chance to
change a whole bunch of pathnames.
I have tried using
request.getRealPath("tmp.pdf")
to get a path that the rest of my project will understand. The path it
returns does not exist; it was only by searching the disk that I
actually managed to find where the file really was.
So:
(1) is there a way of forcing runReportToPdfFile to put the file where
I want it to go? ie to a directory visible to the rest of the project?
(2) how else can I refer to this file? I noticed that
request.getRealPath is deprecated; I couldn't figure out how to do it
properly.
(3) Once I know how to get to the file, if I do this:
<a href="path/filename.pdf">My file</a>
will IE know what to do with the file (assuming Acrobat is installed)?