Hi,
Are you using init() method of the servlet for
fetching init parameters like this?
String str =
getServletConfig().getInitParameter("param1");
Rgrds,
Hardik
--- Raasi Potluri <[EMAIL PROTECTED]> wrote:
> Dear Friends,
>
> I have written a simple servlet which reads a init
> parameter from the web.xml file and displays on the
> browser. I'm a beginner and trying to learn simple
> servlets, I have reached where I can read some init
> params from the web.xml file and displays on the
> browser, but all the simple servlets are working
> without any hassle, but reading init parameter
> returns
> null in the servlet, because I triend to print that
> on
> to the console, but it returns null, please help me,
> awaiting a reply, regards Raasi
>
> web.xml looks like this
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!--
> Copyright 2004 The Apache Software Foundation
>
> Licensed under the Apache License, Version 2.0
> (the
> "License");
> you may not use this file except in compliance
> with
> the License.
> You may obtain a copy of the License at
>
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in
> writing, software
> distributed under the License is distributed on an
> "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
> either
> express or implied.
> See the License for the specific language
> governing
> permissions and
> limitations under the License.
> -->
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> version="2.4">
>
> <display-name>Welcome to Tomcat</display-name>
> <description>
> Welcome to Tomcat
> </description>
>
>
> <!-- JSPC servlet mappings start -->
>
> <servlet>
>
>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
>
>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
> </servlet>
>
> <servlet-mapping>
>
>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
> <url-pattern>/index.jsp</url-pattern>
> </servlet-mapping>
>
>
> <servlet>
> <servlet-name>HelloServlet</servlet-name>
> <servlet-class>HelloServlet</servlet-class>
> </servlet>
>
>
> <servlet-mapping>
> <servlet-name>HelloServlet</servlet-name>
> <url-pattern>/HelloServlet</url-pattern>
> </servlet-mapping>
>
> <servlet>
>
>
<servlet-name>InternationalizedHelloWorld</servlet-name>
>
>
<servlet-class>com.jspbook.InternationalizedHelloWorld</servlet-class>
> <init-param>
> <param-name>greeting</param-name>
> <param-value>Kisahairetu</param-value>
> </init-param>
> </servlet>
>
> <servlet-mapping>
>
>
<servlet-name>InternationalizedHelloWorld</servlet-name>
>
>
<url-pattern>/InternationalizedHelloWorld</url-pattern>
> </servlet-mapping>
>
> <!-- JSPC servlet mappings end -->
>
> </web-app>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]