Solved

Change password using jsp and servlet

Posted on 2004-04-09
6
657 Views
Last Modified: 2012-08-13
In servlet page, i am getting the input value type by the user from the jsp
String oldpass = request.getParameter("oldpass");
String newpass = request.getParameter("newpass");
String confirmpass = request.getParameter("confirmpass");

Now the problem come, i want to use the if statement to tell if the newpass(which is the user key in for new password) is not the same as the confirmpass(which the user key in for the confirm password) then there will be error ...

below is my coding, how am i going to add into this if statement???

 if (oldpass.equals("") || newpass.equals("") || confirmpass.equals("") ){
            // login failed
      request.setAttribute("error", "yes");      
RequestDispatcher rd = request.getRequestDispatcher("/password.jsp");
      rd.forward(request, response);
            }
..................




0
Comment
Question by:YvonneYap
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 25 total points
ID: 10792224

The condition you have to check is

newpass.equals(confirmpass)

may be like this

if (oldpass.equals("") || newpass.equals("") || confirmpass.equals("") || newpass.equals(confirmpass) ) {
0
 

Author Comment

by:YvonneYap
ID: 10796471
em.... i mean if the newpass is not equal to comfirmpass then there will be error.
0
 

Author Comment

by:YvonneYap
ID: 10803588
Is there anyone can help
0
 
LVL 13

Assisted Solution

by:copyPasteGhost
copyPasteGhost earned 25 total points
ID: 10973364
<%
if (!newpass.equals(comfirmpass )) {
%>
<jsp:forward page="errorpage.jsp" />
<%
}
else {
%>
PAGE CONTENT HERE
<%
}
%>

Cheers,
Ghost
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to dynamically set the form action using jQuery.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question