| Author |
is there any method for finding
|
ramesh kothakonda
Ranch Hand
Joined: Feb 14, 2006
Posts: 40
|
|
hi javaranchers, Is there any method for finding absolute path of Webapplication in servltes. if our webapplication folder name is mywebapp . It is available in webapps folder. May i know the absolute path of mywebapp folder. if you give me answer i will be very thankfull in advance. thanking you regards [ November 14, 2006: Message edited by: Bear Bibeault ]
|
The object oriented way of becoming "RICH" is by INHERITANCE<br />Whoever said money can't buy happiness, didn't know where to shop.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
If you're app has been deployed as an exploded file structure, ServletContext.getRealPath("/") will return the path. If you're app was deployed as a packed war archive then, there really is no path and getRealPath will return null. java.lang.String)" target="_blank" rel="nofollow">http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String) [ November 14, 2006: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
ramesh kothakonda
Ranch Hand
Joined: Feb 14, 2006
Posts: 40
|
|
thank you for giving response, Actually my requirement is to upload a file in specific directory. Suppose I am having directory structure like webapps application WEB-INF IMAGES some static resources I want to upload a file into images folder. In what way i can get the real path of our webapplication .I am doing this one in struts. Thanking you
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56205
|
|
|
Please read Ben's response again. He has answered your question.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Prabhu Venkatachalam
Ranch Hand
Joined: Nov 16, 2005
Posts: 502
|
|
Simple way to do this is, 1. Add your real path where you want to upload files to application.properties file. 2. Read URL from the property file from your JSP or Servlet. In furture if you want to change URL, you just need to change in property file. HTH,
|
Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
|
 |
 |
|
|
subject: is there any method for finding
|
|
|