`
为了明天
  • 浏览: 113821 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

@Results

 
阅读更多
需要引入org.apache.struts2.convention.annotation.Results,结合@Result使用,定义一些映射路径。定义某方法的局部映射路径,参考样例如下:

@Namespace("/security") 
public class UserAction extends BaseAction {
    @Action(value="change",results = {@Result(name="change" ,location = "change.jsp")})
	public String method1(){
......
return "changePwd"; 


也可以定义全局的映射路径,参考样例如下:

@Namespace("/")
@Results({ @Result(name = BaseAction.RELOAD, location = "index.action", type = "redirect"),
		 @Result(name =IndexAction.USER_LIST, location = "/security/user.action", type = "redirect")
@Result(name =IndexAction.ERROR, location = "error.jsp")
	  })
public class IndexAction extends BaseAction {
	public static final String USER_LIST = "user";
public static final String ERROR = "error";
......
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics