您的位置:首页 > 编程语言 > Java开发

基于注解的Struts2 的 @action跳转

2015-12-17 16:55 381 查看
1.最基本的@action注解

@Controller

@Scope(value = "prototype")

@ParentPackage(value = "nocheckLogin")

@Namespace("/home/hellovelocity")

此注解位于class之前,

@Action(value="toHome",results={@Result(name="success",location="/views/hellovelocity.vm")})

此为action注解

访问路径为  http://localhost:8080/ppt-mobile-site/home/hellovelocity/toHome.do

2.跳转到另外一个action

@Action(value="toTest",results={@Result(name="success",type="redirect",location="/home/hellovelocity/toHome.do")})

只需更改action注释即可,此action将跳转至上面的action

访问路径为  http://localhost:8080/ppt-mobile-site/home/test/toTest.do
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: