While run index.jsp
then it must check by method POST
of servlet and task must be go further. But while I'm trying, it doesn't do what it should be.
Executing servlet can perform this task, but if execute index.jsp
it shown error.jsp
as entered wrong credentials but can't perform action by POST
method. Page rendering back to index.jsp
.
Why it so?
index.jsp
<form method="POST" action="j_security_check">
<table cellpadding="0" cellspasing="0" border="0">
<tr>
<td align="right">Username: </td>
<td>
<input type="text" name="j_username">
</td>
</tr>
<tr>
<td align="right">Password: </td>
<td>
<input type="password" name="j_password">
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Login"</td>
</tr>
</table>
</form>
error.jsp
<title>Login Error</title>
</head>
<body>
There was an error logging in. Please try again.
</body>
ControllerServlet.java
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
response.getWriter().println("Welcome");