Java/jsp help.

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
I'm trying to run this simple code which checks if a password exists in an xml user file.

Code:
for (int y = 0; y < passwords.getLength(); y++) {
	if (password == passwords.item(y).getTextContent()) {
		out.println("yes");
	}	
}

But everytime I run this nothing prints out on the web page! I have no problem using the .getTextContent to print out a list of all users passwords, but this comparison statement never evaluates to true for some reason, using .equals() even gives me a nullpointer exception!
 
Last edited:
I found out why I was getting a null pointer exception when using .equals(), I had given the password textbox the wrong id. :o
 
Back
Top Bottom