It's a basic servlet...
Here is the code:

public class techSupportServlet extends HttpServlet {
  String driver;

  public void init() throws ServletException {
    driver = getServletConfig().getInitParameter("driver");

  }

  protected void doPost(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException {
...

Kenny

----- Original Message -----
From: "Shapira, Yoav" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, September 19, 2003 5:36 PM
Subject: RE: Init Parameter



Owdy,
If you have an invalid web.xml, tomcat will tell you on startup that it
can't parse it.  Otherwise, you should be able to retrieve init
parameters after the servlet is initialized.  Post your servlet's
relevant code.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Mailing List Servlet [mailto:[EMAIL PROTECTED]
>Sent: Friday, September 19, 2003 11:34 AM
>To: Tomcat Users List
>Subject: Re: Init Parameter
>
>Hello Shapira,
>
>I first tried with only the init-param (no context param) and it
already
>didn't work .
>And I have the same problem with all my others servlets... :-(
>
>I really don't understand why tomcat is enable to retrieve some
information
>but not all...
>If there was a mistake in my web.xml file, I guess I'll receive an
error on
>loading the servlet?
>
>Kenny
>
>
>----- Original Message -----
>From: "Shapira, Yoav" <[EMAIL PROTECTED]>
>To: "Tomcat Users List" <[EMAIL PROTECTED]>
>Sent: Friday, September 19, 2003 5:14 PM
>Subject: RE: Init Parameter
>
>
>
>Howdy,
>Strange... Make sure the context-param and init-param names are
>different.
>
>Yoav Shapira
>Millennium ChemInformatics
>
>
>>-----Original Message-----
>>From: Mailing List Servlet [mailto:[EMAIL PROTECTED]
>>Sent: Friday, September 19, 2003 11:11 AM
>>To: [EMAIL PROTECTED]
>>Subject: Init Parameter
>>
>>Hello everybody,
>>
>>I started to learn servlets few times ago. Everything was working
>perfectly
>>until I tried to get my <init-param> from my web.xml file.
>>I receive all the time a null value when I ask the value of my
>parameter:
>>String driver = getServletConfig().getInitParameter("driver").
>>
>>If I put the parameter in a <context-param>, no problem, it works.
>>String driver = getServletContext().getInitParameter("driver");
>>
>>Can someone help me. Thanks
>>Kenny
>>
>>Here is my web.xml file:
>>
>><web-app>
>>  <context-param>
>>    <param-name>driver</param-name>
>>    <param-value>12345</param-value>
>>  </context-param>
>>
>>  <servlet>
>>    <servlet-name>techSupport</servlet-name>
>>    <servlet-class>techSupportServlet</servlet-class>
>>
>>    <init-param>
>>      <param-name>driver</param-name>
>>      <param-value>54321</param-value>
>>    </init-param>
>>  </servlet>
>>
>>  <servlet-mapping>
>>    <servlet-name>techSupport</servlet-name>
>>    <url-pattern>/techSupport</url-pattern>
>>  </servlet-mapping>
>></web-app>
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>This e-mail, including any attachments, is a confidential business
>communication, and may contain information that is confidential,
>proprietary
>and/or privileged.  This e-mail is intended only for the individual(s)
to
>whom it is addressed, and may not be saved, copied, printed, disclosed
or
>used by anyone else.  If you are not the(an) intended recipient, please
>immediately delete this e-mail from your computer system and notify the
>sender.  Thank you.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to