Answer the question
In order to leave comments, you need to log in
Can you answer questions about web.xml in javaEE, is it about authentication?
Right now I got to the topic in web.xml - user authentication and there are a couple of questions:
1) Eat this code:
<security-constraint>
<web-resource-collection>
<web-resource-name>SecureJSP</web-resource-name>
<url-pattern>/jsp/vip.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Danil</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>Danil</role-name>
</security-role>
<form action="j_security_check" method="post">
<input type="text" name="j_username"><br/>
<input type="password" name="j_password"><br/>
<input type="submit" value="Login">
</form>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/jsp/login.jsp</form-login-page>
<form-error-page>/jsp/error.jsp</form-error-page>
</form-login-config>
</login-config>
Answer the question
In order to leave comments, you need to log in
Here in security-role>role-name we add user roles, and in auth-constraint->role-name we add those who can be admitted when entering a password and nickname?
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/jsp/login.jsp</form-login-page>
<form-error-page>/jsp/login.jsp?fail</form-error-page>
</form-login-config>
</login-config>
<c:if test="${param.fail != null }" >
<span class="error">Неправильное имя пользователя или пароль</span>
</c:if>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question