我用的ssh框架,在修改或者保存对象的时候报此错误,他的提示很明显是request null,也就是说请求为null,请看以下代码:
@Action(value = "stuAction_save",results = {
@Result(name = "success",type = "redirect",location = "../../pages/base/standard.jsp")
})
public String save(){
stuService.save(getModel());
return SUCCESS;
}
之所以报此错误是因为我的Action中location的路径错误,在Action层中不应该再写../../的相对路径,把./../删除后正常运行.
修改后的代码为:
@Action(value = "stuAction_save",results = {
@Result(name = "success",type = "redirect",location = "/pages/base/standard.jsp")
})
public String save(){
stuService.save(getModel());
return SUCCESS;
}
另外导致这个错误的还可能是由于对象没有被注入到对应的类中,一般使用@Autowired或者@Resource等(2018/03/31 添加)