The process you have to follow is:
create a jsp or even just a plain html document with a <form> tag and an action attribute pointing to the jsp containing your JDBC logic.
The JSP with the <form> tag must also have a password field and a submit button. The Jsp with the JDBC logic will be called when the user presses the submit button.
Somewhere in your second JSP (The one with the JDBC logic) you should put the statement: "String newPassword = request.getParameter("NewPassword");" This statement retrieves the value passed on by the previous form.
use the variable newPassword when building your SQL statement.
If you want, both the form JSP and the JDBC jsp can be the same document, but you will have to include logic to determine what state you are in. Am I in the state where the user first brings up the page? or am I in the state where the user has already submitted the page and needs a confirmation that the change worked? Hint: If request.getParameter("NewPassword") returns null, you are in the first state.