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 / General / December 2007

Tip: Looking for answers? Try searching our database.

File creation in the web applications' root

Thread view: 
sasuke - 11 Dec 2007 17:30 GMT
Hello all.

Is it possible to get the path at which my application root is placed
by means of either the ServletContext or the ServletConfig object?

What I am trying to do here is to dynamically create a Javascript file
on the fly and put in the script directory of my web application. But
since the working directory in a web applications case is the
directory which contains the app servers' executable, any new file
created would be created there and I don't want to hard code the path
to my script folder. I want everything to be relative to the
applications' root as far as possible.

Can it be done without any special configuration, the way I can get a
resource present in the application root by the getResource() method?
Any kind of help would be greatly appreciated.

Regards,
sasuke.
Andrew Thompson - 11 Dec 2007 23:58 GMT
...
>Is it possible to get the path at which my application root is placed
>by means of either the ServletContext or the ServletConfig object?

<http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.ht
ml#getRealPath(java.lang.String

)>

Signature

Andrew Thompson
http://www.physci.org/

sasuke - 12 Dec 2007 15:11 GMT
> ..
>
[quoted text clipped - 3 lines]
> <http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/Servle...
> )>

Thank you, really appreciated.


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.