日期:2014-05-20  浏览次数:20873 次

围观
哪位大哥帮我看看偶滴代码哪里出问题了呀

UserAction

package com.frank.action;
import java.util.List;


import com.frank.dao.UserDAo;
import com.frank.obj.User;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
 private UserDAo userDao;
 private User user;
 private List users;
 private int userid;
 private int pageNo;
 private int pageCount;
 public int getPageNo() {
  return pageNo;
 }
 public void setPageNo(int pageNo) {
  this.pageNo = pageNo;
 }
 public void setUsers(List users) {
  this.users = users;
 }
 public int getUserid() {
  return userid;
 }
 public void setUserid(int userid) {
  this.userid = userid;
 }
 public User getUser() {
  return user;
 }
 public void setUser(User user) {
  this.user = user;
 }
 public String readyUpdate() throws Exception{
  user=this.getUserDao().getUserById(userid);
  if(user!=null){
  return SUCCESS;
  }
  return INPUT;
 }
 public String login() throws Exception{
  if(this.getUserDao().checkUser(user)){
  computePageCount();
  users=this.getUserDao().getAllUsers(pageNo);
  return SUCCESS;
  }
  return INPUT;
 }
 public String updateUser() throws Exception{
  if(this.getUserDao().updateUser(user)){
  computePageCount();
  users=this.getUserDao().getAllUsers(pageNo);
  return SUCCESS;
  }
  return INPUT;
 }
 public String deleteUser() throws Exception{
  User user=this.getUserDao().getUserById(userid);
  if(this.getUserDao().deleteUser(user)){
  computePageCount();
  users=this.getUserDao().getAllUsers(pageNo);
  return SUCCESS;
  }
  return INPUT;
 }
 public String insertUser() throws Exception{
  if(this.getUserDao().insertUser(user)){
  computePageCount();
   
  users=this.getUserDao().getAllUsers(pageNo);
  return SUCCESS;
  }
  return INPUT;
 }
 public String selectUser() throws Exception{
  computePageCount();
  users=this.getUserDao().getAllUsers(pageNo);
  return SUCCESS;
  
 }
 public void computePageCount(){
  int tempCount=this.getUserDao().getItemCount();
  pageCount=tempCount%10==0?tempCount/10:tempCount/10+1;  
 }
 @Override
 public String execute() throws Exception {
  // TODO Auto-generated method stub
  return super.execute();
 }
 public List getUsers() {
  return users;
 }
 public void setUsrs(List users) {
  this.users = users;
 }
 public int getPageCount() {
  return pageCount;
 }
 public void setPageCount(int pageCount) {
  this.pageCount = pageCount;
 }
public UserDAo getUserDao() {
return userDao;
}
public void setUserDao(UserDAo userDao) {
this.userDao = userDao;
}

 
}


------解决方案--------------------
java.lang.NullPointerException
com.frank.action.UserAction.login(UserAction.java:44)
------解决方案--------------------
<bean id="userDao" class="com.frank.dao.UserDAo">
<property name="hibernateTemplate">