Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6932615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:43:41+00:00 2026-05-27T11:43:41+00:00

Why does config.getInitParameter(String) always return null in the following code example? public void init(ServletConfig

  • 0

Why does config.getInitParameter(String) always return null in the following code example?

public void init(ServletConfig config) throws ServletException
{
    super.init(config);
    filename = config.getInitParameter("addressfile");

This is web.xml file

<servlet>
<servlet-name>ListManagerServlet</servlet-name>
<servlet-class>savva.listmanagerservlet.ListManagerServlet</servlet-class>
<init-param>
    <param-name>addressfile</param-name>
    <param-value>d:\temp\demo.txt</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ListManagerServlet</servlet-name>
<url-pattern>/ListManagerServlet</url-pattern>
</servlet-mapping>

UPD: Eclipse EE Indigo, Java 1.6, Tomcat 7.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:43:42+00:00Added an answer on May 27, 2026 at 11:43 am

    The canonical way is to just use the inherited GenericServlet#getInitParameter() in the argumentless init() method (and remove any init(config) method).

    @Override
    public void init() throws ServletException {
        filename = getInitParameter("addressfile");
    }
    

    If that still doesn’t work, then your web.xml is not properly been deployed, or you have a typo in the parameter name, or you actually accessed a different instance variable than filename to use/test it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any experience with the following fluent config error? faultString = An
i have the following: responseEncoding=utf-8 in the globalization web.config does that mean if i
I am using following code to replace the passwords in my app.config. It replaces
Does enabling the configuration option with-config-file-scan-dir when compiling PHP lead to performance issues? Specifically,
Does anyone have an XSLT that will take the app.config and render it into
How does one copy resource files (config/data/image) files to an applictions home directory on
Does anyone know of any good tools/utilities for managing Web.Config files between different build/deployment
Does anyone know how i can use BST for config.time_zone in my rails config/environment.rb
Does it have any major effect on performance/ memory if my web.config is really
what does it means struts controller reads the struts-config.xml file when ever web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.