java.lang.NullPointerException
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)
Dao类代码:
public Admin validate(String username, String password)
{
try{
Session session=this.sessionFactory.openSession();
Transaction ts=session.beginTransaction();
Query query=session.createQuery(” from ADMIN where USERNAME=? and PASSWORD=?”);
query.setParameter(0,username);
query.setParameter(1,password);
query.setMaxResults(1);
Admin userTable=(Admin)query.uniqueResult();
if(userTable!=null){
return userTable;
}else{
return null;
}
}catch(Exception e){
e.printStackTrace();
return null;
}
action类代码:
public class login extends ActionSupport{
private Admin ut;
private String username;
private String password;
private admindao ud;
public Admin getUt() {
return ut;
}
public void setUt(Admin ut) {
this.ut = ut;
}
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 admindao getUd() {
return ud;
}
public void setUd(admindao ud) {
this.ud = ud;
}
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
Admin us=ud.validate(this.username,this.password);
if(us!=null){
Map session= (Map)ActionContext.getContext().getSession();
session.put(“us”, us);
return SUCCESS;
}else
return ERROR;
}
10
10
10
10
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
StrutsActionProxy.java:69报的空指针,但是这是struts2的东西~~可能是你配置问题