Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change password using jsp and servlet

Posted on 2004-04-09
6
Medium Priority
?
890 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 100 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 100 total points
ID: 10973364
<%
if (!newpass.equals(comfirmpass )) {
%>
<jsp:forward page="errorpage.jsp" />
<%
}
else {
%>
PAGE CONTENT HERE
<%
}
%>

Cheers,
Ghost
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

636 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