関連: ウェルカム ページを Struts アクションに設定するにはどうすればよいですか?
ウェルカム ページの index.jsp をアクション (Struts2) にリダイレクトしようとしています。関連する投稿のオプションはどれも私にとってはうまくいきませんでした:
type Status report
message /malelo/indexRedir
description The requested resource (/malelo/indexRedir) is not available.
私はこのフロー構造に従っています:
http://localhost:8580/malelo/ SEND TO WELCOME PAGE
---> (root)index.jsp SEND USER TO (by redirect, I need forward)
---> (indexRedir) IndexAction.java SEND USER TO
---> (WEB-INF/content) index-login.jsp
これは機能しましたが、エレガントではありません (index.jsp):
<%
response.sendRedirect("indexRedir");
%>
私はこれをやろうとしています(index.jsp):
<jsp:forward page="indexRedir" />
私は注釈のみを使用しており、XML ファイルの構成は使用していません。
@Action (value = "indexRedir", results =
{ @Result (location = "index-login.jsp", name = "ok") } )
編集
明確にするために、これは response.sendRedirect によってブラウザーに送信される http ヘッダーです。
HTTP/1.1 302 Found
Date: Tue, 27 May 2014 16:15:12 GMT
Location: http://cmabreu.com.br/basico/
Content-Length: 0
Connection: close
Content-Type: text/plain
この場所 ( http://cmabreu.com.br/basico/ ) は、次の index.jsp を指しています。
<%
response.sendRedirect("indexRedir");
%>
また、indexRedir アクションが指す JSP ページの内容を表示します。Google Webmasters Tools と一部のボットは、そのようなページをフォローしません。