4
我有以下web.xml文件我保持歡迎頁面進入安全檢查,以便它將重定向到登錄頁面,但歡迎頁面顯示時沒有用戶登錄。這是正確的辦法? 歡迎頁面顯示時沒有被重定向到登錄頁面
<welcome-file-list>
<welcome-file>/GISPages/welcome.xhtml</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jdbc/Gis_WebApp</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Pages</web-resource-name>
<url-pattern>/GISPages/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>registereduser</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Live</realm-name>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/noauth.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>registereduser</role-name>
</security-role>
<security-role>
<role-name>admin</role-name>
</security-role>
在'web-resource-collection'標籤下,你有'url-pattern'的重複條目。這可能是問題的原因。文件的其餘部分在哪裏? – 2012-02-24 12:14:25
@maple_shaft刪除了這些,但仍然是同樣的問題。以及我已經添加了圖像文件。 – kinkajou 2012-02-24 13:57:46
只是比較它與我的配置。唯一不同的是,login.xhtml和error.xhtml也位於受保護的文件夾中,而不是外部。只是一個猜測。 – 2012-02-24 14:29:04