struts注解问题,我想像xml配置一样,根据判断返回不同的页面,下面是action中的一个方法,求赐教,没分了
@Action(value="login",results={@Result(name="success",location="product/products1.htm...
@Action(value = "login", results = { @Result(name = "success", location = "product/products1.html"), @Result(name = "failure", location = "product/products.html") })
public String login() {
Json json = new Json();
if (this.userService.login(p)) {
json.setSuccess(true);
json.setMsg("登录成功!!!");
super.writeJson(json);
return "success";
} else {
json.setMsg("登录失败!!!");
super.writeJson(json);
return "failure";
}
}
异常信息:No result defined for action hjt.action.UserAction and result success
解决办法
@Action(value="userAction",results={ @Result( name="success" , location="/product/products.html", type="redirect"), @Result( name="failure" , location="/product/products1.html", type="redirect" )}) 展开
public String login() {
Json json = new Json();
if (this.userService.login(p)) {
json.setSuccess(true);
json.setMsg("登录成功!!!");
super.writeJson(json);
return "success";
} else {
json.setMsg("登录失败!!!");
super.writeJson(json);
return "failure";
}
}
异常信息:No result defined for action hjt.action.UserAction and result success
解决办法
@Action(value="userAction",results={ @Result( name="success" , location="/product/products.html", type="redirect"), @Result( name="failure" , location="/product/products1.html", type="redirect" )}) 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询