In web.xml:
<context-param>
<param-name>open-port</param-name>
<param-value>7180</param-value>
<description>Port for regular HTTP via Apache</description>
</context-param>
<context-param>
<param-name>secure-port</param-name>
<param-value>7143</param-value>
<description>Port for HTTPS via Apache</description>
</context-param>
and in the jsp page:
<HTML>
<BODY>
parameters are:<BR>
open-port=<%= application.getInitParameter("open-port") %><BR>
secure-port=<%= application.getInitParameter("secure-port") %><BR>
</BODY>
</HTML>
or in the servlet:
String open_port = getServletContext().getInitParameter("open-port");
String secure_port = getServletContext().getInitParameter("secure-port");
Jan
Jan K. Labanowski | phone: 614-292-9279, FAX: 614-292-7168
Ohio Supercomputer Center | Internet: [EMAIL PROTECTED]
1224 Kinnear Rd, | http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163 | http://www.osc.edu/
On Tue, 14 Aug 2001 [EMAIL PROTECTED] wrote:
> I have multiple servlets in the same directory and they all get the same
> init-params from web.xml.
>
> Currently, I have 5 servlets and am required to repeat all the init-params
> 5 times, one for each servlet. So if one parameter changes, I have to
> change it five times in web.xml. I'd like to only have them in the web.xml
> file once and all servlets use them. How is this possible?
>
> One approach I took was to create a servlet that all my other servlets
> subclassed and all it did was grab the init-params. I couldn't get it to
> work.
>
> Any ideas?
>
> Thanks,
>
> JEB
>