You are currently browsing the daily archive for September 2nd, 2008.
if you want to get path where calss is located ..here is code
URL url =getClass().getProtectionDomain().getCodeSource().getLocation();
hop its helpfull
write here if you feel its helpful
cherrrrrrrrrrzzzzzzzzzzzzz
How to add veriable/enviorment variabls in web application.these are the variable you can access anywhere in project
here is solution
addfollwing tag to web xm…and given values of your own choics
<env-entry>
<env-entry-name>webmasterEmail</env-entry-name>
<env-entry-value>admin@domain.com</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
you can access in a code by this
// Get a handle to the JNDI environment naming context
Context env = (Context)new InitialContext().lookup("java:comp/env");
// Get a single value
String webmasterEmail = (String)env.lookup("webmasterEmail");
thats It ...enjoyyyyyyyy
here is the helping uRL
http://wiki.metawerx.net/wiki/Web.xml.EnvEntry
comment here if it is useful for you

