Servlets can retrieve initialization values through it's init() method.
First you must define the values in the web.xml:
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>mypackage.MyServlet</servlet-class>
<init-param>
<param-name>username</param-name>
<param-value>Fred</param-value>
</init-param>
</servlet>
You can not retrieve this value with the init() method:
public void init(ServletConfig config) throws ServletException {
String initialUsername = getInitParam("username");
}
HTH.
Or you could not listen to me and use the proper method:
public void init(ServletConfig config) throws ServletException {
String initialUsername = getInitParameter("username");
}
Sorry about that...