Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

Finding the path to the program folder with JSP tags.

Thread view: 
Tore Ottinsen - 27 Apr 2005 20:39 GMT
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 - 27 Apr 2005 23:54 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.