title: Values are null in action class struts 2
body: <p>I have a jsp page as below (ConfigureRate.jsp):</p>
  
  <pre><code>&lt;s:form action="modifyrate.action" method="post"&gt;
                      &lt;s:textfield label="Country" name="selectedCountry" value="%{#session.selectedCallRates.country}" size="20" disabled="true" /&gt;
                      &lt;s:textfield label="Country Code" name="countrycode" value="%{#session.selectedCallRates.countrycode}" size="20" disabled="true"/&gt;
                      &lt;s:textfield label="Call Direction" name="selectedCallType" value="%{#session.selectedCallRates.callType}" disabled="true"/&gt;
                      &lt;s:textfield label="Device Type" name="selectedDeviceType" value="%{#session.selectedCallRates.deviceType}" disabled="true"/&gt;
                      &lt;s:textfield name="rate" key="label.rate" size="20" /&gt;
                      &lt;s:submit method="modifyRate" key="Update" align="center" /&gt;
                  &lt;/s:form&gt;
  </code></pre>
  
  <p>And have the setters and getters in the action class for selectedCallType, selectedDeviceType etc .....</p>
  
  <p>Action Code : </p>
  
  <pre><code>public class ConfigureRatesAction extends ActionSupport {
  
  private List&lt;CallRates&gt; callRates;
  private String selectedCountryRow;
  private String selectedCallType;
  private String selectedDeviceType;
  private String country;
  private int countrycode;
  private double rate;
  private String selectedCountry;
  private static final Logger log = Logger.getLogger(ConfigureRatesAction.class);
  
  public String displayModify() {
  
      Boolean loggedin = (Boolean) ActionContext.getContext().getSession().get("loggedin");
      CallRatesDAO callRatesDAO = new CallRatesDAO();
  
      if (loggedin == null || !loggedin) {
          addActionError(getText("error.loggedin"));
          return "loggedout";
      }
  
      if (selectedCountryRow == null) {
          callRates =
                  callRatesDAO.getCallRates();
          addActionError("Select a row to modify");
          return ERROR;
      }
  
      CallRates selectedCallRates = buildCallRates(selectedCountryRow);
  
      if (selectedCallRates == null) {
          callRates = callRatesDAO.getCallRates();
          addActionError("Select a row to modify");
          return ERROR;
      } else {
          ActionContext.getContext().getSession().put("selectedCallRates", selectedCallRates);
          return SUCCESS;
      }
  
  }
  
  public String modifyRate() {
  
  
  
      Boolean loggedin = (Boolean) ActionContext.getContext().getSession().get("loggedin");
  
      if (loggedin == null || !loggedin) {
          addActionError(getText("error.loggedin"));
          return "loggedout";
      }
  
      CallRatesDAO callRatesDAO = new CallRatesDAO();
  
      log.info("Values :"+selectedCountry+" "+countrycode+" "+selectedCallType
              +" "+selectedDeviceType+" "+rate);
  
  
      if (callRatesDAO.updateRate(selectedCountry, rate, Integer.toString(countrycode),
              selectedCallType, selectedDeviceType)) {
          callRates = callRatesDAO.getCallRates();
          addActionMessage(getText("success.modifyrate"));
          return SUCCESS;
      } else {
          addActionError(getText("errors.modifyrate"));
          return ERROR;
      }
  }
  
  private CallRates buildCallRates(String selectedCountryRow) {
  
      StringTokenizer token = new StringTokenizer(selectedCountryRow, "*");
      CallRates cR = new CallRates();
      int i = 1;
  
      while (token.hasMoreTokens()) {
          if (i == 1) {
              cR.setCountry(token.nextToken());
          } else if (i == 2) {
              cR.setCountrycode(Integer.parseInt(token.nextToken()));
          } else if (i == 3) {
              cR.setCallType(token.nextToken());
          } else if (i == 4) {
              cR.setDeviceType(token.nextToken());
          }
          i++;
      }
  
      return cR;
  }
  
  public List&lt;CallRates&gt; getCallRates() {
      return callRates;
  }
  
  public void setCallRates(List&lt;CallRates&gt; callRates) {
      this.callRates = callRates;
  }
  
  public String getCountry() {
      return country;
  }
  
  public void setCountry(String country) {
      this.country = country;
  }
  
  public int getCountrycode() {
      return countrycode;
  }
  
  public void setCountrycode(int countrycode) {
      this.countrycode = countrycode;
  }
  
  public double getRate() {
      return rate;
  }
  
  public void setRate(double rate) {
      this.rate = rate;
  }
  
  public String getSelectedCallType() {
      return selectedCallType;
  }
  
  public void setSelectedCallType(String selectedCallType) {
      this.selectedCallType = selectedCallType;
  }
  
  public String getSelectedCountry() {
      return selectedCountry;
  }
  
  public void setSelectedCountry(String selectedCountry) {
      this.selectedCountry = selectedCountry;
  }
  
  public String getSelectedCountryRow() {
      return selectedCountryRow;
  }
  
  public void setSelectedCountryRow(String selectedCountryRow) {
      this.selectedCountryRow = selectedCountryRow;
  }
  
  public String getSelectedDeviceType() {
      return selectedDeviceType;
  }
  
  public void setSelectedDeviceType(String selectedDeviceType) {
      this.selectedDeviceType = selectedDeviceType;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>struts.xml :</p>
  
  <pre><code>  &lt;action name="modifyAction"
              class="com.thrupoint.brg.callrates.configurerates.ConfigureRatesAction" method="displayModify"&gt;
          &lt;result name="success"&gt;jsp/ConfigureRate.jsp&lt;/result&gt;
          &lt;result name="error"&gt;jsp/modifyrates.jsp&lt;/result&gt;
          &lt;result name="loggedout"&gt;jsp/Login.jsp&lt;/result&gt;
      &lt;/action&gt;
      &lt;action name="modifyrate"
              class="com.thrupoint.brg.callrates.configurerates.ConfigureRatesAction" method="modifyRate"&gt;
          &lt;result name="success"&gt;jsp/modifyrates.jsp&lt;/result&gt;
          &lt;result name="input"&gt;jsp/ConfigureRate.jsp&lt;/result&gt;
          &lt;result name="error"&gt;jsp/ConfigureRate.jsp&lt;/result&gt;
          &lt;result name="loggedout"&gt;jsp/Login.jsp&lt;/result&gt;
      &lt;/action&gt;
  </code></pre>
  
  <p>When I print the values of these properties in action class, I get null, except rate property which doesn't have value attribute in above jsp form.</p>
  
  <p>Why are other properties are null?</p>