我使用Web Flow和JSF,因此它們實際上運行良好。但我試圖找出設置默認頁面的另一種方式,不同於在index.html上重定向。Web Flow + JSF集成默認頁面
主要問題是Web分析腳本無法正常工作。我無法跟蹤用戶源主頁。
在Tomcat 8所述的應用程序運行
Web.xml中
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
的index.html
<html>
<head>
<meta http-equiv="Refresh" content="0; URL=web/home-page">
</head>
</html>
UPDATE:
我取代的index.html具有索引。 jsp和我設置響應狀態爲301.至少它適用於谷歌分析,所以我會檢查出其他分析工具。 但是這個解決方案仍然不能滿足我。
的web.xml
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
的index.jsp
<%
response.setStatus(301);
String path=(String)request.getAttribute("javax.servlet.forward.request_uri");
if(path==null){
path="web/home-page";
}
response.setHeader("Location", path);
response.setHeader("Connection", "close");
%>
我對Spring Web Flow並不熟悉,但爲什麼不能在'welcome-file'中指定所需的文件呢? – DavidS
感謝您的建議,但不能像JSF那樣使用表達式和其他函數不起作用。它不是簡單的HTML。 – erdoganonur
@erdoganonur您是否在使用彈簧安全項目? – Selwyn