title: Identifying why INPUT is returned in Struts2
body: <p>I have a piece of code with about 100 variables in my Action Class. They are not directly accessible in the JSP Page i.e. the name attribute of the JSP page is different from the variable name in the Java Action Class. The values in the JSP page are set according to changes in Javascript.</p>
  
  <p>For eg :</p>
  
  <pre><code>&lt;!-- HTML --&gt; 
  &lt;!--js is called on page load--&gt;
  &lt;s:hidden name="optionJava"&gt;&lt;/s:hidden&gt;
  
  &lt;s:select id="optionValues" name="values"&gt; 
    &lt;option&gt;SelectedA&lt;/option&gt;
    &lt;option&gt;SelectedB&lt;/option&gt;
  &lt;/s:select&gt;
  
  //Struts2 - Action class
  private int optionJava;
  
  //Javascript
  if(document.getElementById('optionJava').value==1){
    if(document.getElementById('optionValues').selectedIndex==1){
    document.getElementById('values').value==10;
    //Based on the 10 that is now the selected option's value , another field is     triggered.
    }
  }
  </code></pre>
  
  <p>Based on such a structure, the optionJava values keep changing to display either another field if 1 is selected or display nothing if 2 is selected.</p>
  
  <p>Now, because of this 1 and 2, the values that I am getting with 1 (which can be considered as 'Yes') work perfectly in the application i.e. the Page returns SUCCESS.
  However if i select 2 (which can be considered as 'No' for a particular field), the other field is not triggered and the page returns INPUT.</p>
  
  <p>With over a 100 variables in my page, I am not sure which variable(s) are causing this issue.</p>
  
  <p>What is the practice to be followed while checking for INPUT - Validation and presence of variable in the Java class is a must I know, but I don't understand why the same code works when 1 is selected and goes to INPUT when 2 is selected?</p>