- PR -

return new ActionForward("xxxdo",true);での画面遷移

1
投稿者投稿内容
未記入
会議室デビュー日: 2008/04/03
投稿数: 3
投稿日時: 2008-04-03 18:13
strutsとtomcat使っています。
画面の遷移がたまにおかしくなります。
おかしくなる条件はつかめていません。

index.jsp(アプリケーションの一番始めのページ)の中身
response.sendRedirect("./tologin.do");

tologin.doで呼ばれる画面:ログイン画面

画面X→ActionA→ActionB→画面Y
ActionAに記述されている遷移先:return new ActionForward("toB.do",true);

という流れになっていますが、ごくたまに画面X→ログイン画面へとんでしまいます。

tomcatのログを見ると、
正常な時は
Mapping contextPath='/application' with requestURI='/application/toB.do' and relativeURI='/toB.do'
Mapped to servlet 'action' with servlet path '/toB.do' and path info 'null' and update=true
Mapping contextPath='/application' with requestURI='/application/jsp/画面Y' and relativeURI='/jsp/画面Y'

となっています。
異常な時は
Mapping contextPath='/application' with requestURI='/application/' and relativeURI='/'
Mapped to servlet 'action' with servlet path '/' and path info 'null' and update=true
Mapping contextPath='/application' with requestURI='/application/jsp/index.jsp' and relativeURI='/jsp/index.jsp'

となっていて、パスが抜けてしまっているようなのですが・・・

tomcatの再起動でも解消されず、tologin.doを手打ちすることでなぜか正常に戻りました。

return new ActionForward("toB.do",true);での遷移がいけないのでしょうか。

findForwardにして、struts-config.xmlでredirect属性を設定することと、意味は同じなのでしょうか?findForwardにすることで解消されるのでしょうか?
あえてこの部分だけがActionForwardになっているのですが、何か意味があるのでしょうか?

findForwardとsendRedirectの違いも今日初めて知ったど素人です。
アドバイスよろしくお願いします。
べる
ぬし
会議室デビュー日: 2003/09/20
投稿数: 1093
投稿日時: 2008-04-03 21:11
ここは.NETの会議室で、Javaはこちらですね。
http://www.atmarkit.co.jp/bbs/phpBB/viewforum.php?forum=12
未記入
会議室デビュー日: 2008/04/03
投稿数: 3
投稿日時: 2008-04-04 09:04
すみません。ありがとうございます。
失礼いたしました・・・
1

スキルアップ/キャリアアップ(JOB@IT)