Archives

Posts Tagged ‘servlets’

[eg. of web.xml <web-app> <servlet> <servlet-name>ReadInitParams</servlet-name> <servlet-class>com.company.MyServlet</servlet-class> <display-name>Example Servlet</display-name> <init-param> <param-name>emailHost</param-name> <param-value>192.168.1.1</param-value> </init-param> </servlet> </webapp> In Servlet Code: public void init(ServletConfig config) throws ServletException { String emailHost = config.getInitParameter(“emailHost”); } or public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String host = getServletConfig().getInitParameter(“emailHost”); } In JSP Code: <html> <head><title>Read Init params from a […]

Aug 20th, 2006 | Filed under java
Tags: ,