我正在嘗試使用登錄頁面身份驗證創建應用程序。對於同樣的我添加<form-login-page>
到web.xml中(如下所示)。我可以把表單登錄頁面html放在一個webapp的庫中嗎?
我打開了logon.html和logonerror.html,並將它們作爲庫與.war webapp文件一起添加。 (在WEB-INF/lib/logon.jar下)。
但是當我部署應用程序時,得到錯誤404,logon.html未找到錯誤。 任何指向爲什麼?我不能讓登錄文件(htmls,js,css文件)保存在一個庫中嗎?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>MyFilter</filter-class>
<init-param>
<param-name>Domainname</param-name>
<param-value></param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>SecuredResources</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Default_Role</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONF</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/logon.html</form-login-page>
<form-error-page>/logonerror.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>Default_Role</role-name>
</security-role>
</web-app>