title: How to use if else in scriplets in jsp as a condition to show radio button values
body: <p>I am working in an application where i am fetching data from the database,and i want to show the data in a radio button on the basis of the values,i.e i have an employementstatus that is either employed or not employed. Now i am getting the employementstatus from the database.But i can not show that value in the radio button,like there are two radio buttons if the employemntstatus is employeed then the employed radio will be checked else the Not employed one. Here Is my code</p>
  
  <pre><code>     for(int i=0;i&lt;existingProfile.size();i++) {    
      employmentStatus = existingProfile.get(i).getEmploymentStatus();
  </code></pre>
  
  <p>Here the employed status is either employed or Not Employed.Now i am  doing this in my radio buttons </p>
  
  <pre><code>       &lt;tr&gt;
                  &lt;th&gt;Current Employment status&lt;span style='color: #FF0000; display: inline;'&gt;*&lt;/span&gt;&lt;/th&gt;
  
  
                  &lt;% if(employmentStatus.equals("Employeed")) {%&gt;
                  &lt;td&gt;
                      &lt;input type="radio" name="employementStatus" value="&lt;%=employmentStatus %&gt;"&gt;Employeed
                      &lt;input type="radio" name="employementStatus" value="Not Employeed"&gt;Not Employeed&lt;br&gt;
                  &lt;/td&gt;
                  &lt;%}else if(employmentStatus.equals("Not Employeed"))
                  {%&gt;  
                  &lt;td&gt;
                      &lt;input type="radio" name="employementStatus" value="Employeed"&gt;Employeed
                      &lt;input type="radio" name="employementStatus" value="Not Employeed"&gt;Not Employeed&lt;br&gt;
                  &lt;/td&gt;
                  &lt;%}
  
                  %&gt;
  
              &lt;/tr&gt; 
  </code></pre>
  
  <p>In this code the problem is that when i am submitting the value after checking the radio buttons it is going to the database.Because i can see the emplyementstatus value in the jsp page  when i am doing out.println(emplyementstatus).But after logging out from the page when i am again logging into the application  the radio buttons  are unchecked.But i am still able to print the employement status in the jsp page,it is coming properly.</p>