Hi there,
You may have hit on one of the interesting quirks about working with Java objects in JavaScript.
In JavaScript, you can test for string equality using the == and != operators. This compares the values of the strings and everything works really nicely between two JavaScript strings.
In Java, as you know, you cannot use == or != since that's performing a comparison between the object instances (which could have the same value but which could be entirely different objects). Java has different mechanism for this and provides .equals() as a means for comparing two objects.
In looking at your code, it seems possible that you're comparing a JavaScript string with a Java string.
A better means of comparison maybe to call toString() on the objects and then compare those results. Check for null ahead of time of course.
Let me know if this helps.
Michael