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>
</context-param>." Why can't the compiler resolve this line? Thank you in advance.
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");
The application object is available only in JSPs. You probably mixed code from a JSP example........