Sorry Chinni, but that didnt't work. Why isn't there a connection between the server and the compiler?
Dominik -----Ursprungliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 7. Februar 2002 20:15 An: Tomcat Users List Betreff: Re: Newbie problem with reading init params You actually read them from ServletContext not from the ServletConfig. You can get the Servlet Context by doing... ServletContext sc = getServletContext(); Hope this helps. -Chinni. Dominik Jednoralski To: [EMAIL PROTECTED] <tomcat@lime- cc: design.de> Subject: Newbie problem with reading init params 02/07/02 12:02 PM Please respond to Tomcat Users List Hey Guys, I have a problem with getting my init-params from the web.xml-file. These are the parameters I inserted into the webapps/root/web-inf/web.xml-file: <web-app> <servlet> <servlet-name>ShowMsg</servlet-name> <servlet-class>limeservlets.ShowMessage</servlet-class> <init-param> <param-name>message</param-name> <param-value>Nerv-Serv</param-value> </init-param> <init-param> <param-name>repeats</param-name> <param-value>5</param-value> </init-param> </servlet> </web-app> Now I failed to read these parameters with the follwing servlet: package limeservlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class ShowMessage extends HttpServlet { private String message; private String defaultMessage = "Leider keine Nachricht."; private int repeats = 1; public void init (ServletConfig config) throws ServletException{ super.init(config); message = config.getInitParameter("message"); if (message == null) { message = defaultMessage; } try { String repeatString = config.getInitParameter ("repeats"); repeats = Integer.parseInt(repeatString); } catch (NumberFormatException nfe){} } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "The Servlet which shows a message!"; out.println(ServletUtilities.headWithTitle(title) + "<body bgcolor=#fdf5f6>\n<h1>"+ title + "</h1><br>"); for (int i = 0; i < repeats; i ++) { out.println(message + "<br>"); } out.println("</body></html>"); } } Does anyone know the reason for that? I for myself don't have a clue- I'm not really into configuring servers... Dominik Jednoralski . Lime Design Mediengestaltung . Lilienstr. 23 . 63768 Hvsbach . Tel. 06021.550470 . visit www.lime-design.de -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]> -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]> -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>