One problem you might have is using == for comparing the contents of two Strings.
You should use the equals() method for that.