title: Struts2 : ognl.MethodFailedException: Method "setMontant" failed for object dao.Operation@1ed5095
body: <p>I have an object which need to be updated "opereation", the following form is used to update it. I have a Double attribute called Montant that created the problem, I can't update it because the form return a String and not a double value, </p>
  
  <p>but when i want to update my object "operation", i found this error :</p>
  
  <pre><code>    Avertissement: Error setting value
      ognl.MethodFailedException: **Method "setMontant"** failed for object dao.Operation@1ed5095 [java.lang.NoSuchMethodException: **setMontant([Ljava.lang.String;)]**
          at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
          at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
          at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
          at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
          at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
          at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
  ...............................
  </code></pre>
  
  <p>Form.jsp</p>
  
  <pre><code>    &lt;s:form  validate="true"  namespace="/"   name="form" id="form"&gt;
  
     &lt;s:select id="immatriculs" list="immatriculs" label="immatriculation" name="immatricul"&gt;
  &lt;/s:select&gt;
       &lt;&lt;s:textfield  id="datepicker" name="dt_debut" label="Date début :"  &gt;
  &lt;s:textfield  id="montant" name="montant" label="Montant :"&gt;
      &lt;s:submit action="ajouterassurance"  name="Enregistrer" value="Inserer"&gt; &lt;/s:submit&gt;
  
      &lt;/s:form&gt;
  </code></pre>
  
  <p>pojo :</p>
  
  <pre><code>  public class Operation {
  
          private Integer idOperation;
          private Date dt_debut;
          private Double montant;
          private String immatricul;
  
      // setters and getters 
  
      public Double getMontant() 
      {
          return montant;
      }
      public void setMontant(Double montant) 
      {
          this.montant = montant;
      }
  
      }
  </code></pre>
  
  <p>Actionclass :</p>
  
  <pre><code>public class GestionOperations extends ActionSupport implements ModelDriven&lt;Operation&gt;{
  
      private Operation operation = new Operation();
  
      private OperationService operationservice;
  
      public GestionOperations() {
          //contructor
      }
  
  
  
      public String add() 
      {
                  operationservice = new OperationServiceImpl();
                  operationservice.AddOperation(operation);
  
                  return "success";
      }
  
      public String execute()
      {
  
          return "success";
      }
  
      @Override
      public Operation getModel() {
          // TODO Auto-generated method stub
          return operation;
      }
  
  
  }
  </code></pre>
  
  <p>I try to change "setMontant" to this :</p>
  
  <pre><code>public void setMontant(String montant)
  {
  this.monatnt = Double.parseDouble(montant);
  
  }
  </code></pre>
  
  <p>but in this case it return <code>null</code> value, </p>