Post Reply 
 
Thread Rating:
  • 1 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read a Web Application property
12-15-2010, 01:33 AM
Post: #1
Read a Web Application property
Web Application properties are defined in the WEB-INF/web.xml deployment descriptor (in between the <webapp> </webapp> tag)

<env-entry>
<env-entry-name>docPath</env-entry-name>
<env-entry-value>c:/doc/doc1</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

<env-entry>
<env-entry-name>docUser</env-entry-name>
<env-entry-value>net1</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

Then from your JSP or Servlet,

Context env = (Context) new InitialContext().lookup("java:comp/env");
String docBase = (String) env.lookup("docPath");
String docBaseUser = (String) env.lookup("docUser");
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:



Send your comments, Suggestions or Queries regarding this site at info@tutorials4u.net

Copyright © 2010 Tutorials4u.net All Rights Reserved