tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yin Tse <y...@valicert.com>
Subject RE: Servlet init parameters problems
Date Tue, 12 Dec 2000 23:43:23 GMT
Here's the code I use to read the the init parameters :		


logFile = config.getServletContext().getInitParameter("logFile");
System.out.println("LogFile: " + logFile);			
			driverName = config.getInitParameter("driverName");
System.out.println("driverName: " + driverName);			
			connectionUrl =
config.getInitParameter("connectionUrl");
System.out.println("connectionUrl: " + connectionUrl);			
			login = config.getInitParameter("login");
System.out.println("login: " + login);			
			password = config.getInitParameter("password");
System.out.println("password: " + password);

	base_url=config.getInitParameter("Base_url");
System.out.println("base_url= "+base_url);
	
	images_url=config.getInitParameter("Images_url");
System.out.println("images_url =" + images_url);
	
	valicert_url=config.getInitParameter("url");
System.out.println("url= "+url);
	
 	servlet_url=config.getInitParameter("Servlet_url");
System.out.println("servlet_url= "+servlet_url);		


Thanks.
-----Original Message-----
From: Yin Tse [mailto:yint@valicert.com]
Sent: Tuesday, December 12, 2000 3:18 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: Servlet init parameters problems



Hi all,
I'm having some problems reading my init parameters.
I define the init parameters in the web.xml file like this :


   <servlet>
        <servlet-name>login</servlet-name>
        <servlet-class>LoginServlet</servlet-class>
        <init-param>

	    <param-name>login</param-name>
            <param-value>joe</param-value>	 

	    <param-name> password</param-name>
            <param-value>pass</param-value>	 

    		<param-name>driverName</param-name>
            <param-value>oracle.jdbc.driver.OracleDriver</param-value>

	    <param-name> connectionUrl</param-name>
            <param-value>jdbc:oracle:thin:@xena:1521:wbdb</param-value>	

	    <param-name>url</param-name>
            <param-value>www.whatever.com</param-value>

	    <param-name>Base_url</param-name>
            <param-value>http://intranet/whateber/</param-value>	

	    <param-name>Images_url</param-name>
            <param-value>http://intranet/whatever/images</param-value>	
	

	
	    
	    <param-name>Servlet_url</param-name>
            <param-value>/servlet/</param-value>

	   
	</init-param>
    </servlet>

These are defined in the LoginServlet, but the parameters are read in a
parent servlet called DBConnectionServlet,
but all the params are coming null except the last one which is servlet_url
here.If I change the order and put the login init param at the bottom,
that's the param which will be read and all others come up null. Does anyone
know why ? Thanks for the feedback.




Mime
View raw message