public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
try
{
String sC_LMBH = request.getParameter("sC_LMBH");
String sql = null;
String sC_XWBH[] = request.getParameterValues("chkID");
if(sC_XWBH != null)
{
for(int i = 0; i < sC_XWBH.length; i++)
{
sql = "update t_zjxw a set a.c_fbbz= decode(a.c_fbbz,0,1,1,0,0) where C_SJZQBJ='" + sC_LMBH + "'and a.c_xwbh='" + sC_XWBH[i] + "'";
//System.out.println(sql);
db.setSqlString1();
//dba.executeUpdate();
//dba.commit();
} response.sendRedirect("../ZjxwManageBrowse.jsp?sC_LMBH=" + sC_LMBH);
}
//dba.close();
}
catch(Exception exception) {
exception.printStackTrace();
}
}
db.setSqlString1();
调用方法tomcat总是报错为空java.lang.NullPointerException 请各位大虾求助
throws ServletException, IOException
{
try
{
String sC_LMBH = request.getParameter("sC_LMBH");
String sql = null;
String sC_XWBH[] = request.getParameterValues("chkID");
if(sC_XWBH != null)
{
for(int i = 0; i < sC_XWBH.length; i++)
{
sql = "update t_zjxw a set a.c_fbbz= decode(a.c_fbbz,0,1,1,0,0) where C_SJZQBJ='" + sC_LMBH + "'and a.c_xwbh='" + sC_XWBH[i] + "'";
//System.out.println(sql);
db.setSqlString1();
//dba.executeUpdate();
//dba.commit();
} response.sendRedirect("../ZjxwManageBrowse.jsp?sC_LMBH=" + sC_LMBH);
}
//dba.close();
}
catch(Exception exception) {
exception.printStackTrace();
}
}
db.setSqlString1();
调用方法tomcat总是报错为空java.lang.NullPointerException 请各位大虾求助
你debug进去看看 如果还找不到 把这个方法的代码贴出来
throws SQLException
{
System.out.println(sql);
}
这是我这个方法的内容
你就没传sql参数呀
算初始化么
哥哥,db为null啊
你要实例化啊。