I have this code in my .jsp file:
<%= formBean.getMonth() == "default" %>
I print the value first to make sure it equals to “default”:
<%= formBean.getMonth() %>
and it does, but when I compare it to “default” as I do above it prints false. I am puzzled what
could the problem be.
Thanks
Use
equals()method to compare the String values as below::==will compare the object instances and return false in your case as the String object instances are not the same.