servlet/web.xml configuration question


Web tier: servlets, JSP, Web frameworks: servlet/web.xml configuration question

  1. servlet/web.xml configuration question (2 messages)

    I'm new to Object-Oriented Programming so please bear with me as I stumble along and ask my questions. I have a servlet located at /WEB-INF/classes/inventory/ I keep getting " cannot resolve symbol
    symbol : variable application
    location: class inventory.AssetMove
                           String PROPERTIES_FILE = application.getInitParameter("");" This application.getInitParameter is located in a try block. My web.xml file has an entry of "<context-param>
           </context-param>." Why can't the compiler resolve this line? Thank you in advance.
  2. servlet/web.xml configuration question[ Go to top ]

    there is no variable named "application" in your class. that's why the compiler is complaining. there is no built-in reference to the servlet context from within a servlet, so if you want access to a context parameter, you'll need to do something like:

    String param = getServletContext().getInitParameter("");
  3. The application object is available only in JSPs. You probably mixed code from a JSP example........