when i run my jsp script i get this error posting:
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:346)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
root cause
java.lang.NullPointerException
bean.OfficeRegBean.getData(OfficeRegBean.java:209)
bean.OfficeRegBean.getEmployees(OfficeRegBean.java:161)
org.apache.jsp.employees_jsp._jspService(employees_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
now here is my getEmployees method:
public ResultSet getEmployees()
{
query = "SELECT * FROM employees";
return getData(query);
}
And here is my getData method:
public ResultSet getData(String query)
{
try
{
if (trace)
{
connectToDB();
}
// Create the statement
Statement mystatement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
// Create the Resultset
return mystatement.executeQuery(query) ;
}
catch (SQLException sqle)
{
//System.out.println("getData: " + sqle.getMessage());
return null;
}
}
any help would be greatly apprecaited to why i get this error or how it can be fixed
thanks
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:346)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
root cause
java.lang.NullPointerException
bean.OfficeRegBean.getData(OfficeRegBean.java:209)
bean.OfficeRegBean.getEmployees(OfficeRegBean.java:161)
org.apache.jsp.employees_jsp._jspService(employees_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
now here is my getEmployees method:
public ResultSet getEmployees()
{
query = "SELECT * FROM employees";
return getData(query);
}
And here is my getData method:
public ResultSet getData(String query)
{
try
{
if (trace)
{
connectToDB();
}
// Create the statement
Statement mystatement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
// Create the Resultset
return mystatement.executeQuery(query) ;
}
catch (SQLException sqle)
{
//System.out.println("getData: " + sqle.getMessage());
return null;
}
}
any help would be greatly apprecaited to why i get this error or how it can be fixed
thanks