Domanda

I am looking for some ways to use the same login page as login page and login error page. I found a way to do this. When users input the wrong userid or password, it should use the same page with the error warning shown. But the error warning is never shown. Can anyone please check what is wrong with it?

In my web.xml:

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.jsp</form-login-page>
        <form-error-page>/login.jsp?Retry=True</form-error-page>
    </form-login-config>
  </login-config>

In my login.jsp:

<form class="login" METHOD=POST ACTION="j_security_check">
<table>
    <c:if test='${not empty param["Retry"]}'>
        <tr>
        <td colspan="2" class="lploginerrormessage">Incorrect User ID
                or Password. Please try again.</td>
        </tr>>
    </c:if>

    <tr>
        <td>User ID:</td>
        <td><input type="text" name="j_username" size="20"></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input type="password" name="j_password" size="20">
        </td>
    </tr>
</table>
</form>

Suppose that "Incorrect User ID or Password. Please try again." will show up if users made a incorrect input. but it is not showing no matter how many times I input the wrong login info. I did not find any incorrect thing. Could anyone tell me what is wrong with my codes? Also any other ideas about how to achieve the same goal will be welcome. I will thumb up you if the idea is good.

È stato utile?

Soluzione

Thank you thinksteep for quick respond. I found the reason. It is because I include the wrong source. I should use <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> instead of <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top