title: How to use search and save button in struts2 form?
body: <p>Here is my form</p>
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;s:form action="changeStatus"&gt;
      &lt;s:div class="table"&gt;
          &lt;s:textfield name="custId" label="CUSTOMER ID" /&gt;
          &lt;s:textfield name="lifewardsCard" label="LIFE WARDS CARD NUMBER"
              size="20" /&gt;
          &lt;s:textfield name="clientNo" label="CLIENT NUMBER" /&gt;
          &lt;s:textfield name="custName" label="CUSTOMER NAME" /&gt;
          &lt;s:textfield name="cardExpiryDate" label="CARD EXPIRY DATE(MMYYYY)" /&gt;
          &lt;s:select name="status" label="CARD STATUS"
              list="#{'1':'Active', '2':'Inactive'}" /&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;s:submit value="search" theme="simple" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;s:submit value="save" theme="simple" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;s:submit type="button" theme="simple"
                      onclick="clear();return false;" value="clear" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/s:div&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>user will input the field custID and clicks search button
  I am able to get the values from database and show them on the page
  but what I wanted to do is after displaying the data he can edit the data and should be able to save the data by clicking save button.
  here's my xml configuration</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;action name="changeStatus" class="com.struts.lifewardscard.ChangeAction"&gt;
      &lt;result name="input"&gt;ChangeCardStatus.jsp&lt;/result&gt;  
      &lt;result name="success"&gt;ChangeCardStatus.jsp&lt;/result&gt;
  &lt;/action&gt;       
  </code></pre>
  
  <p>and here is my action class</p>
  
  <pre><code>public class ChangeAction extends ActionSupport implements ModelDriven {
      CardStatusForm cardSform=new CardStatusForm();
      public String execute() throws Exception{
          String clientId=null;
          HttpServletRequest request = ServletActionContext.getRequest();
          getCardHolderDetails();     
          return "success";
  
      }
  
      private void getCardHolderDetails() {
          Connection c = null;
          Boolean empty = true;
          DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");
  
          // Format date into output format
          DateFormat outputFormat = new SimpleDateFormat("dd-MMM-yyyy");
          try {
              c = Conexion.getConnection();
              CallableStatement cst = c
                      .prepareCall("{call P_GET_CARD_DETAIILS(?,?)}");
              cst.setString(1, cardSform.getCustId());
              cst.registerOutParameter(2, OracleTypes.CURSOR);
              cst.executeUpdate();
              ResultSet rs = (ResultSet) cst.getObject(2);
              while (rs.next()) {
                  cardSform.setLifewardsCard(rs.getString(1));
                  cardSform.setClientNo(rs.getString(2));
                  if(rs.getString(3).equalsIgnoreCase("active"))
                  {
                      cardSform.setStatus(1);
                  }else
                  {
                      cardSform.setStatus(2);
                  }
  
                  cardSform.setCustName(rs.getString(4));
                  cardSform.setCardExpiryDate(rs.getString(5));
                  System.out.println(inputFormat.parse(rs.getString(6)));
                  empty = false;
              }
  
          } catch (Exception e) {
              e.printStackTrace();
          }
  
  
      }
  
  
      @Override
      public Object getModel() {
          // TODO Auto-generated method stub
          return cardSform;
      }
  }
  </code></pre>
  
  <p>even though I can write a method that can save the data in action class I dont find a way to call that method with out calling the other method <code>getCardHolderDetails()</code>.</p>