Received: (qmail 81656 invoked by uid 501); 3 Apr 2001 16:12:04 -0000 Message-Id: <20010403161204.81655.qmail@apache.org> Date: 3 Apr 2001 16:12:04 -0000 From: Enrique Ortiz Reply-To: enrique.ortiz.torrent@europe.eds.com To: submit@bugz.apache.org Subject: when i call getInitParameter in the Httpservlet init method, always returns null X-Send-Pr-Version: 3.110 >Number: 7507 >Category: mod_jserv >Synopsis: when i call getInitParameter in the Httpservlet init method, always returns null >Confidential: no >Severity: non-critical >Priority: medium >Responsible: jserv >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Tue Apr 03 09:20:01 PDT 2001 >Closed-Date: Tue Apr 03 10:50:58 PDT 2001 >Last-Modified: Tue Apr 03 10:50:58 PDT 2001 >Originator: enrique.ortiz.torrent@europe.eds.com >Release: 1.3.14 >Organization: >Environment: linux mandrake 7.2 Linux tc75050.tecno.es 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i686 unknown apache + jserv 1.1.2 using IBM jdk 1.1.8 >Description: import java.io.*; import java.lang.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import oracle.jdbc.driver.*; public class listArgs extends HttpServlet { java.lang.String OracleUser = null; java.lang.String OraclePsw = null; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { res.setContentType("text/html"); PrintWriter os = res.getWriter(); os.println(""); os.println("Error"); os.println(""); os.println("
"); os.println("

"+ OracleUser+"

"); // ---> null os.println("

"+ OraclePsw+"

"); // ---> null os.println("
"); os.println("

"+getInitParameter("OracleUser") +"

"); // ---> value os.println("

"+getInitParameter("OraclePsw") +"

"); // ---> value os.println("
"); os.println(""); os.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } public void init(ServletConfig config) throws ServletException { super.init(config); java.lang.String OracleUser = getServletConfig().getInitParameter("OracleUser"); java.lang.String OraclePswd = getServletConfig().getInitParameter("OraclePsw"); } >How-To-Repeat: import java.io.*; import java.lang.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import oracle.jdbc.driver.*; public class listArgs extends HttpServlet { java.lang.String OracleUser = null; java.lang.String OraclePsw = null; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { res.setContentType("text/html"); PrintWriter os = res.getWriter(); os.println(""); os.println("Error"); os.println(""); os.println("
"); os.println("

"+ OracleUser+"

"); // ---> null os.println("

"+ OraclePsw+"

"); // ---> null os.println("
"); os.println("

"+getInitParameter("OracleUser") +"

"); // ---> value os.println("

"+getInitParameter("OraclePsw") +"

"); // ---> value os.println("
"); os.println(""); os.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } public void init(ServletConfig config) throws ServletException { super.init(config); java.lang.String OracleUser = getServletConfig().getInitParameter("OracleUser"); java.lang.String OraclePswd = getServletConfig().getInitParameter("OraclePsw"); } >Fix: >Release-Note: >Audit-Trail: State-Changed-From-To: open-closed State-Changed-By: jon@clearink.com State-Changed-When: Tue Apr 3 10:50:58 PDT 2001 State-Changed-Why: Init parameters in JServ work fine. This is a configuration error on your part. >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]