Home > Archive > Java Help > April 2005 > Finding the path to the program folder with JSP tags.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Finding the path to the program folder with JSP tags.
|
|
| Tore Ottinsen 2005-04-27, 8:59 pm |
| I'm making a program which uses JSP (custom tags) to get information from a
form at the page and save it as an .xml document. I use apache Tomcat to run
my program. Problem is, the .xml files are automatically saved where Java
is run from, in my case C:/Windows/System32. That's not where I want the
files at all. But I cannot use a direct path to the program folder within
Tomcat, as this will differ depending on which computer the program is run
on. I want to save the files in the program's main folder, where the JSP
pages are located.
How do I find the path to this folder? I've tried to search google for an
answer, but everything I've found tells me to use 'getRealPath()', which is
a method for servlets that does exactly this (I've used it for the same
purpose before). But there is no servlet involved in this part of my
program, only custom tags. Is there an equivalent of getRealPath for custom
tags, or another easy way to do this?
| |
| enrique 2005-04-27, 8:59 pm |
| It has been awhile since I've done any servlet programming, but look
for a method called "getServletContext" or something like that. I
think what you can do (in conjunction with this method) is -- using a
url to a known JSP -- determine what the internal file path is to it.
If I can better recall what to do, I'll write again.
|
|
|
|
|