Solved

Change password using jsp and servlet

Posted on 2004-04-09
6
542 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now