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/AssetMove.java. I keep getting "AssetMove.java:26: cannot resolve symbol
symbol : variable application
location: class inventory.AssetMove
String PROPERTIES_FILE = application.getInitParameter("webfile.properties");" This application.getInitParameter is located in a try block. My web.xml file has an entry of "<context-param>
<param-name>webfile.properties</param-name>
<param-value>/export/home/tomcat/resources/inventory.properties</param-value>
</context-param>." Why can't the compiler resolve this line? Thank you in advance.
-
servlet/web.xml configuration question (2 messages)
- Posted by: Lon Needham
- Posted on: August 18 2004 15:20 EDT
Threaded Messages (2)
- servlet/web.xml configuration question by Jon Crater on August 18 2004 21:50 EDT
- servlet/web.xml configuration question by Sohail Sikora on August 19 2004 15:04 EDT
-
servlet/web.xml configuration question[ Go to top ]
- Posted by: Jon Crater
- Posted on: August 18 2004 21:50 EDT
- in response to Lon Needham
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("webfile.properties"); -
servlet/web.xml configuration question[ Go to top ]
- Posted by: Sohail Sikora
- Posted on: August 19 2004 15:04 EDT
- in response to Lon Needham
The application object is available only in JSPs. You probably mixed code from a JSP example........