日期:2014-05-18  浏览次数:20700 次

小白求救 DAO的问题
ICustomerDAO.getaa()
DAO里面的方法一用就抛空指针 检查了下配置文件没发现什么错误 蒙圈了
下面是全部代码


CustCustomerAction.java

import java.io.Serializable;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.hibernate.criterion.Restrictions;

import com.javalines.hibernate.dao.base.IBaseDAO;
import com.javalines.hibernate.dao.cust.ITbCustCustomerDAO;
import com.javalines.hibernate.page.EntityView;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;
import com.javalines.struts2.action.base.BaseAction;
import com.javalines.util.AjaxUtils;

public class CustCustomerAction extends BaseAction<TbCustCustomer> implements
ServletRequestAware, ServletResponseAware, SessionAware,
ApplicationAware {
public final static String ID_LIST_PARAM = "idList";
public final static String PAGE_NUM_PARAM = "nowPage";
// request
protected HttpServletRequest request;
// response
protected HttpServletResponse response;
// HTTP session
protected Map<String, Object> session;
// application
protected Map<String, Object> application;
private ITbCustCustomerDAO ICustomerDAO;

public ITbCustCustomerDAO getICustomerDAO() {
return ICustomerDAO;
}

public void setICustomerDAO(ITbCustCustomerDAO customerDAO) {
ICustomerDAO = customerDAO;
}

public void setApplication(Map<String, Object> arg0) {
this.application = arg0;
}

public void setSession(Map<String, Object> arg0) {
this.session = arg0;
}

public void setServletResponse(HttpServletResponse arg0) {
this.response = arg0;
}

public void setServletRequest(HttpServletRequest arg0) {
this.request = arg0;
}


public IBaseDAO<TbCustCustomer, Serializable> getEntityDAO() {
// TODO Auto-generated method stub
return null;
}

public void checkLoginName(){
try{
String username = request.getParameter("username");
System.out.println(ICustomerDAO.getaa());

AjaxUtils.renderJson(json);
}catch(Exception e){
e.printStackTrace();
}


}




struts_mall.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="mallPkg" extends="struts-default" namespace="">
<interceptors>
<!-- 定义拦截堆栈 -->
<