Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<%--@elvariable id=\"loginFailed\" type=\"java.lang.Boolean\"--%> <template:logg

ID: 3850985 • Letter: #

Question

<%--@elvariable id="loginFailed" type="java.lang.Boolean"--%>
<template:loggedOut htmlTitle="Log In" bodyTitle="Log In">
You must log in to access the customer support site.<br /><br />
<c:if test="${loginFailed}">
<b>The username and password you entered are not correct. Please try
again.</b><br /><br />
</c:if>
<form method="POST" action="<c:url value="/login" />">
Username<br />
<input type="text" name="username" /><br /><br />
Password<br />
<input type="password" name="password" /><br /><br />
<input type="submit" value="Log In" />
<input type="submit" value="Forget Password?" />
</form>
</template:loggedOut>

Add Forgot Password Functionality: (

On the login screen, below the login button add a link forgot password. On clicking on the link display a form with the following option to enter your email address:

Once the user enters his email address, send the password associated with his email address to his email id.

Existing Related Files:

login.jsp

The page has Forget Passwork button but NOT WORKING!. If i click Forget Password then it would display "The username and password you entered are not correct. Please try
again".

Explanation / Answer

First of all add the following field to enter email id in the forgot password code:


Since, you are using the post method, you need to add the following code to your servlet:


The above code will do the necessary email verification for changing password. Then, to change the password, add the following code:

This will change the password in the database.

PS: The following queries must run in your MySQL

Hope, the above solution helps. It is platform independent and accurate.

You may contact further for any doubts.