Web application properties can be read from JSP or Servlet using the code below:

Java Code:
Context env = (Context) new InitialContext().lookup("java:comp/env");
String docBase = (String) env.lookup("docPath");
String docBaseUser = (String) env.lookup("docUser");
Properties are given in WEB-INF/web.xml deployment descriptor.

Java Code:
<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