FreshmenProgrammer
Programmer
Hello,
First I would like to say thanks in advance for the help!!
This is the error im getting.
SEVERE: null
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:209)
I'm not sure if im not setting the application scope variable right or im not getting it right because i'm always getting a null value. Please let me know the right way of getting and setting application scope variables. Thank you!!
First I would like to say thanks in advance for the help!!
This is the error im getting.
SEVERE: null
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:209)
I'm not sure if im not setting the application scope variable right or im not getting it right because i'm always getting a null value. Please let me know the right way of getting and setting application scope variables. Thank you!!
Code:
EISDAO eis = new EISDAO();
eis.setDBHost(config.getInitParameter("dbhost"));
//etc etc..
// i set the application scope variable in an init like this
config.getServletContext().setAttribute("eisdao", eis);
//
public SISDAO getEISDAO() {
return (EISDAO)getServletContext().getAttribute("eisdao");
}