Solved

Change password using jsp and servlet

Posted on 2004-04-09
6
748 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

718 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