我想在Post被Save 成功之後
直接轉到 viewPost 頁面
該頁面顯示主貼及所有跟貼
也就是由savePost
action 轉到 viewPost
action 並且要將主貼的postid作為參數傳過去
配置如下
<package name=
post
namespace=
/post
extends=
struts
default
>
<action name=
savePost
method=
savePost
class=
ngfanpp
bbs
post
web
action
PostAction
>
<result type=
redirect
action
>viewPost?postid=${postid}</result>
<result name=
input
>/WEB
INF/pages/post/edit
jsp</result>
</action>
<action name=
viewPost
class=
ngfanpp
bbs
post
web
action
PostAction
method=
viewPost
>
<result>/WEB
INF/pages/post/view
jsp</result>
</action>
</package>
Note: 紅色粗體部分 viewPost?postid=${postid} 不能寫成 viewPost
action?postid=${postid}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28000.html