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

关于一段代码的问题
public String login() throws Exception {
try {
Users loginUser = articleService.login(u.getUname(), u.getUpass());
if (loginUser != null) {
ActionContext context = ActionContext.getContext();
context.getSession().put("LOGINUSER", loginUser);
return SUCCESS;
}
} catch (Exception e) {
logger.error("登录查询错误", e);
return ERROR;
}
return INPUT;
}


public Users getU() {
return this.u;
}

public void setU(Users u) {
this.u = u;
}

public Users login(String uname, String upass) {

List list = usersDAO.findByUname(uname);
if (null == list || list.size() == 0)
return null;
Users u = (Users) usersDAO.findByUname(uname).get(0);
if (null == u)
return null;
if (uname.equals(u.getUname()) && upass.equals(u.getUpass()))
return u;
else
return null;
}

public String getUname() {
return this.uname;
}

public void setUname(String uname) {
this.uname = uname;
}

public String getUpass() {
return this.upass;
}

public void setUpass(String upass) {
this.upass = upass;
}
为什么在前面login里面,输出一直是error,哪里有错吗?请高手帮忙看下,谢谢

------解决方案--------------------
e.printStackTrace();把错误日志打出来
------解决方案--------------------
如1楼所说,需要详细的错误信息。