title: How to compare Strings in if-else statements?
body: <p>I wonder if anyone could give me a pointer with some pre-population in JSP:</p>
  
  <p>So I am attempting to pre-populate a checkbox depending on the value in the customers database record. The checkbox would be checked if there is a 1 in the field, the other option would be a 0 - where the checkbox should be empty.</p>
  
  <p>I am currently using this code within the input:</p>
  
  <pre><code>&lt;%if (UPDATEDPREFERENCES != null)
  { 
      if (ISNEWSLETTER != "0") {
          out.println("checked");
      } 
  }
  %&gt;
  </code></pre>
  
  <p>so it would be:</p>
  
  <pre><code>&lt;input type='checkbox' class="newsletter" name='temp_ISNEWSLETTER_FIELD' id="temp_ISNEWSLETTER_FIELD" &lt;%if (UPDATEDPREFERENCES != null)
  { 
      if (ISNEWSLETTER != "0") {
          out.println("checked");
      } 
  }
  %&gt;/&gt;
  </code></pre>
  
  <p>As it stands, it pre-populates fine. However, it also populates if the field is 0. If I change it to read:</p>
  
  <pre><code>if (ISNEWSLETTER == "1")
  </code></pre>
  
  <p>then the checkbox is empty whether it's a 1 or 0.</p>
  
  <p>Am I missing something obvious? I am not a developer, I am in NYC and my support is in Belgium - they've all left for the day.</p>