1) For each servlet defined in web.xml, and for example, lets say we have the following servlet defined in web.xml...
<servlet>
<servlet-name>SnoopServlet</servlet-name>
<servlet-class>examples.servlets.SnoopServlet</servlet-class>
</servlet>
..am I required to define a mapping as well? It seems that I cant manage to access the servlet from my browser when I dont define a mapping. However, if I add the following mapping....
<servlet-mapping>
<servlet-name>SnoopServlet</servlet-name>
<url-pattern>/SnoopServlet</url-pattern>
</servlet-mapping>
..I'm able to access the servlet. I guess coming from a ServletExec background and moving into J2EE, things are a bit different.
2) My other question is this: How do you programmatically access environment variables defined in web.xml? For example, if I define the following environment variable to be used by some class....
<env-entry>
<env-entry-name>error.logpath<env-entry-name>
<env-entry-value>/opt/wl6/logs<env-entry-value>
<env-entry-type>java.lang.String<env-entry-type>
<env-entry>
..how can I access the value of error.logpath from my code? I think I read somewhere that you can use jndi to access this value, but Jesus man!, isn't using jndi to access properties such as the one above a bit resource-intensive?
SAF
-
Question about servlet-mapping and env-entry elements in WEB.XML (0 messages)
- Posted by: SAF .
- Posted on: January 26 2002 19:58 EST