title: Struts2 INPUT result: how does it work? How are conversion / validation errors handled?
body: <p><strong>Main Question</strong> </p>
  
  <p>The work flow should be like this: if an String is entered other than a number, first it should pass through a exception interceptor, and when passing through param interceptor, while converting to int type, it wont be able to do it using <code>Integer.parseInt</code> and an exception would occur; shouldn't that exception (that is <code>NumberFormatException</code>) be pushed into Value Stack ? Why does it not show <code>NumberFormatException</code> and show the result even though result should not be printed instead ?</p>
  
  <p><strong>Side Question</strong> </p>
  
  <p>Whenever I add an alphabet in the form, it changed to zero...? Why so ?</p>
  
  <p><strong>index.jsp</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;s:form action="divide"&gt;
      &lt;s:textfield name="number1" label="number1"/&gt;
      &lt;s:textfield name="number2" label="number2"/&gt;
      &lt;s:submit value="divide"/&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p><strong>divide.java</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>package actions;
  
  public class divide {
      int number1,number2,result;
      public String execute() throws Exception
      {
          result=number1/number2;
          return "success";
      }
      public int getNumber1() {
          return number1;
      }
      public void setNumber1(int number1) {
          this.number1 = number1;
      }
      public int getNumber2() {
          return number2;
      }
      public void setNumber2(int number2) {
          this.number2 = number2;
      }
      public int getResult() {
          return result;
      }
  
  
  }
  </code></pre>
  
  <p><strong>result.jsp</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@taglib uri="/struts-tags" prefix="s" %&gt;
  &lt;b&gt;
      the result of division is
      &lt;s:property value="result"/&gt;
  &lt;/b&gt;
  &lt;jsp:include page="index.jsp"&gt;&lt;/jsp:include&gt;
  </code></pre>
  
  <p><strong>handler jsp</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;b&gt;
      following exception occured during the processing
      &lt;s:property value="exception"/&gt;
  &lt;/b&gt;
  &lt;jsp:include page="index.jsp"/&gt;
  </code></pre>
  
  <p><strong>struts.xml</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!DOCTYPE struts PUBLIC 
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
      &lt;struts&gt;
          &lt;package name="yo" extends="struts-default"&gt;
              &lt;action name="divide" class="actions.divide"&gt;
                  &lt;exception-mapping result="error" exception="Exception"/&gt;
                  &lt;result name="success"&gt;/result.jsp&lt;/result&gt;
                  &lt;result name="error"&gt;/handler.jsp&lt;/result&gt;
              &lt;/action&gt;
          &lt;/package&gt;
      &lt;/struts&gt;
  </code></pre>