title: Unable to set jsp form values to class variables
body: <p>When I try to fetch the values from class, which were set in jsp, null is shown.</p>
  
  <p>Following error is observed in dev mode:</p>
  
  <blockquote>
    <p>ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message):
        Unexpected Exception caught setting 'name' on 'class org.ravi.EmployeeAction: Error setting expression 'name' with value 't'</p>
  </blockquote>
  
  <p>Below are my various pages</p>
  
  <p>struts.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code>&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;constant name="struts.devMode" value="true" /&gt;
      &lt;package name="default" extends="struts-default"&gt;
          &lt;action name="addEmployeeAction" class="org.ravi.EmployeeAction"&gt;
              &lt;interceptor-ref name="params" /&gt;
              &lt;interceptor-ref name="modelDriven"/&gt;
              &lt;result name="success"&gt;/Add.jsp&lt;/result&gt;
          &lt;/action&gt;
          &lt;action name="EmployeeAction" class="org.ravi.EmployeeAction" method="execute"&gt;
              &lt;interceptor-ref name="params" /&gt;
              &lt;interceptor-ref name="modelDriven"/&gt;
              &lt;result name="success"&gt;/index.jsp&lt;/result&gt;
          &lt;/action&gt;
      &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>index.jsp</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1" import="java.util.*,java.io.*"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;s:form action="Add.jsp" name="addForm"&gt;
          &lt;table border="1" cellpadding="5"&gt;
              &lt;tr&gt;
                  &lt;th&gt;Select&lt;/th&gt;
                  &lt;th&gt;EmpID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;City&lt;/th&gt;
                  &lt;th&gt;DoB&lt;/th&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;th&gt;&lt;input type="radio" name="record"
                      onClick="radioValidate(this, 'record')" value="%{var}"&gt;
                  &lt;/th&gt;
                  &lt;th&gt;&lt;s:property value="empid"/&gt;&lt;/th&gt;
                  &lt;th&gt;&lt;s:property value="name"/&gt;&lt;/th&gt;
                  &lt;th&gt;&lt;s:property value="city"/&gt;&lt;/th&gt;
                  &lt;th&gt;&lt;s:property value="dob"/&gt;&lt;/th&gt;
      &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Add.jsp</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@taglib uri="/struts-tags" prefix="s"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Add New User&lt;/h1&gt;
      &lt;s:form action="EmployeeAction" &gt;
      &lt;s:textfield label="Emp Id" name="empid" /&gt;
      &lt;s:textfield label="Name" name="name" /&gt;
      &lt;s:textfield label="City" name="city" /&gt;
      &lt;s:textfield label="DoB" name="dob" /&gt;          
      &lt;s:submit /&gt;
      &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>EmployeeAction.java</p>
  
  <pre><code>package org.ravi;
  
  import com.opensymphony.xwork2.ActionSupport;
  import com.opensymphony.xwork2.ModelDriven;
  
  public class EmployeeAction extends ActionSupport implements ModelDriven&lt;Employee&gt; {
      private static final long serialVersionUID = -8136507522861159378L;
  
      private Employee employee=new Employee();
  
      public Employee getEmployee()
      {
          return employee;
  
      }
  
      public void setEmployee(Employee employee)
      {
          this.employee=employee;
      }
  
      public String execute() throws Exception 
      {
          return SUCCESS;
      }
  
      @Override
      public Employee getModel() 
      {
          return employee;
      }
  }
  </code></pre>
  
  <p>Employee.java</p>
  
  <pre><code>package org.ravi;
  
  import java.io.Serializable;
  
  public class Employee implements Serializable{
  
       static final long serialVersionUID = 1L;
       private String empid;
       private String name;
       private String city;
       private String dob;
  
      public void setempid(String empid) {
          this.empid = empid;
      }
  
      public void setname(String name) {
          this.name = name;
      }
  
      public void setcity(String city) {
          this.city = city;
      }
  
      public void setdob(String dob) {
          this.dob = dob;
      }
  
      public String getempid() {
          return this.empid;
      }
  
      public String getname() {
          return this.name;
      }
  
      public String getcity() {
          return this.city;
      }
  
      public String getdob() {
          return this.dob;
      }
  
  
  }
  </code></pre>