Validation in java Error log in register -


i trying set validation of confirm password , textfield must have value in it. im beginner sir im practicing build log in , register program.

sorry english im not great in speaking english.

my problem code not running fine. keeps telling "fill spaces"

string username = usernamefield.gettext(); string password = passwordfield.gettext(); string cpassword = cpasswordfield.gettext(); if ((username != null) || (password != null) || (cpassword != null)) {     if (password == cpassword) {         db.insertdata(username, password);         joptionpane.showmessagedialog(null, "data has been entered");     }     else {         joptionpane.showmessagedialog(null, "please fill spaces");     } } else if (password != cpassword) {     joptionpane.showmessagedialog(null, "password mismatch"); } 

if((username != null) || (password != null) || (cpassword != null) ){ if(password.equals(cpassword)){     db.insertdata(username, password);     joptionpane.showmessagedialog(null, "data has been entered"); }else {     joptionpane.showmessagedialog(null, "password mismatch"); }    } else { joptionpane.showmessagedialog(null, "please fill spaces"); } 

try code. should use equals() instead of == string comparison


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -