求各位大神 帮助 我的Action 为什么调Biz层为null 心好痛 调了一下午了

Action 类

public class UserAntion {

/**
 * 
 */
private static final long serialVersionUID = 4615706069221133904L;
private String username;
private String password;
private UserLoginBiz userLoginBiz;

public UserLoginBiz getUserloginbiz() {
    return userLoginBiz;
}
public void setUserloginbiz(UserLoginBiz userLoginBiz) {
    this.userLoginBiz = userLoginBiz;
}
public String getUsername() {
    return username;
}
public void setUsername(String username) {
    this.username = username;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}

public String execute() throws Exception  { 
    //BeanFactory factory = new ClassPathXmlApplicationContext("classpath:/beans.xml");
    //userLoginBiz = (UserLoginBiz) factory.getBean("userLoginBiz");
    User user =new User();
    user.setUser_name(getUsername());
    user.setUser_password(getPassword());
    List list=this.getUserloginbiz().login(user);
    if (list!=null&&list.size()>0)  { 
        System.out.println("登录成功"); 
        ServletActionContext.getRequest().setAttribute("list", list);

        return "login";
     } 
    else  { 
        return "login_success"; 


    }

}

}

bizimp

@Service
@Transactional
public class UserLoginBizImpl implements UserLoginBiz {

private UserLoginDao userlogindao;
public UserLoginDao getUserlogindao() {
    return userlogindao;
}

public void setUserlogindao(UserLoginDao userlogindao) {
    this.userlogindao = userlogindao;
}

public List login(User user) {

    return this.getUserlogindao().login(user);
}

}

biz

public interface UserLoginBiz {

public List login(User user);

}

daoimpl

public class UserLoginDaoImpl extends HibernateDaoSupport implements UserLoginDao{

public List login(User user) {
    try{
        String hql="from User  where user_name='"+user.getUser_name()+"' and user_password='"+user.getUser_password()+"'";
        List list =this.getHibernateTemplate().find(hql);
        if(list.size()>0){
            System.out.println(list);

            return list;
        }else 
            return null;

    }catch (Exception e){
        e.printStackTrace();
        return null;
    }



    }

}

dao

public interface UserLoginDao{

public List login(User user);

}

        <bean id="userAntion" class="cn.accp.ontime.web.action.UserAntion" scope="prototype">
        <property name="userloginbiz" ref="userloginbiz"></property>
        </bean>



    <bean id="userLoginDao" class="cn.accp.ontime.dao.impl.UserLoginDaoImpl" scope="prototype"> 
    <property name="sessionFactory " ref="sessionFactory"></property>
    </bean>




/login.jsp
/login_success.jsp

1个回答

List list=this.getUserloginbiz().login(user);

的 userlogbiz=null 怎么回事啊 注入不进去

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问