java - GWT: String comparision is not working -


i have following code in presenter in gwt mvp application:

public void onfailure(serverfailure error) {      string errcode = error.getmessage();      window.alert(errcode);     window.alert("server error: pleaseenterquestion");      if(errcode == "server error: pleaseenterquestion")         window.alert("same");     else         window.alert("different"); } 

the first 2 alerts same. third alert different. expect same.

use equals, not ==, compare strings:

if("server error: pleaseenterquestion".equals(errcode)) 

see question more information: how compare strings in java?


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -