Solved

Change password using jsp and servlet

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

Suggested Solutions

Title # Comments Views Activity
error email attachment VB2010 5 46
replace quotes with UTF-8 character 38 104
How to get statistic's from a competitors website?! 1 112
Randomize in Owl Carousel v1.3.2 6 67
Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

808 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