2012-06-10 3 views
0

lookupDispatchAction에 제출 된 dynaAction 양식 설정이 있습니다. 문제는 페이지가 잘로드되지만 응용 프로그램을 제출하면 [BeanUtils.populate]이 루트 원인으로 java.lang.IllegalArgumentException이 발생 함 : Bean이 지정되지 않음 순간적으로 스택 덤프를 포착 할 수 없다는 메시지가 표시됨 코드에서 이것이 발생하는 곳. 아래에 인쇄 된 JSP에서 코드의 일부로 원인을 식별 할 수 있었던 것은 수정 된 코드를 실행 취소 한 경우에만 발생했습니다. 지금 나는 디버거에서 더 많은 정보를 얻을 수 있는지 알아 내려고 노력하고 있지만, 지금까지는 아무런 도움이되지 않은 가능한 원인에 대한 암시가있었습니다. 스트럿 - config.xml 파일 :제출시 Struts에 No Bean Specified 오류가 발생하는 이유는 무엇입니까?

<form-bean name="MonthlyInvoiceForm" type="com.myapp.form.accounting.MonthlyInvoiceForm"> 
       <form-property name="idMonthInvoice" type="java.lang.Long"/> 
       <form-property name="creationDate" type="java.util.Date"/> 
       <form-property name="adresse" type="com.myapp.model.component.CustomerAddress"/> 
       <form-property name="extras" type="com.myapp.accounting.customer.ExtraInvoiceForm[]"/> 
       <form-property name="creationLoc" initial="Home" type="java.lang.String"/> 
       <form-property name="totalHT" type="java.math.BigDecimal"/> 
       <form-property name="totalTTC" type="java.math.BigDecimal"/> 
       <form-property name="prefix" type="java.lang.Integer"/> 
       <form-property name="number" type="java.lang.String"/> 
       <form-property name="person" type="java.lang.String"/> 
       <form-property name="strTotalHT" type="java.lang.String"/> 
       <form-property name="strTotalTTC" type="java.lang.String"/> 
       <form-property name="customerName" type="java.lang.String"/> 
       <form-property name="strIdCustomer" type="java.lang.String"/> 
       <form-property name="strCreationDate" type="java.lang.String"/> 
     </form-bean> 

자체는 다음 설치가 형태 :

public class MonthlyInvoiceForm extends BaseDynaForm implements ModelForm<MonthlyInvoice>{ 

@Override 
public void reset(ActionMapping mapping, HttpServletRequest request) { 
    ExtraInvoiceForm[] extraForms = new ExtraInvoiceForm[1]; 
    this.set("extras", extraForms); 

    CustomerAddress caddress = new CustomerAddress(); 
    this.set("adresse", caddress); 

    BigDecimal tmpTRD = new BigDecimal(BigInteger.ZERO); 
    this.set("totalHT", tmpTRD); 


    BigDecimal tmpTRM = new BigDecimal(BigInteger.ZERO); 
    this.set("totalTTC", tmpTRM); 
} 

@Override 
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) { 
    ActionErrors errors = new ActionErrors(); 

    ExtraInvoiceForm[] extraInvoiceForms = (ExtraInvoiceForm[]) this.get("extras"); 
    LinkedList<String> credits = new LinkedList<String>(); 
    LinkedList<String> reductions = new LinkedList<String>(); 

    for(ExtraInvoiceForm eif: extraInvoiceForms) { 
     eif.validate(errors); 

     if(!eif.isBlank()) { 
      if(eif.getOperation().equals(ExtraCostInvoice.CREDITOPERATION)) { 
       if(credits.contains(eif.getDescription())) 
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("invoice.duplicate.credit", eif.getDescription())); 
       else 
        credits.add(eif.getDescription()); 
      } else { 
       if(reductions.contains(eif.getDescription())) 
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("invoice.duplicate.reduction", eif.getDescription())); 
       else 
        reductions.add(eif.getDescription()); 
      } 
     } 
    } 


    if (StringUtils.isEmpty(this.get("strCreationDate").toString())) 
     errors.add("strCreationDate",new ActionError("field.required")); 

    if (StringUtils.isEmpty(this.get("creationLoc").toString())) 
     errors.add("creationLoc",new ActionError("field.required")); 



    return errors; 
} 

@Override 
public void populateModel(MonthlyInvoice model) throws Exception { 
    DateTimeFormatter fmt = DateTimeFormat.forPattern("dd MMMM yyyy"); 
    DateTime crDate; 


    crDate = new DateTime(fmt.withLocale(Locale.FRENCH).parseDateTime(this.get("strCreationDate").toString())); 
    this.set("creationDate",BaseForm.jodaToSqlDate(crDate)); 

    PropertyUtils.copyProperties(model, this); 
} 

를 스택 추적 합리적이 게시물을 유지하기 위해 건너 뛰고 다음은 (코드의 관련 부분입니다 는 JSP : 사전에

<html:form action="/toInvoiceCustomerMissions"> 
/*This is the part of code in the jsp which causes the error*/ 
<c:forEach var="extras" items="${MonthlyInvoiceForm.map.extras}" varStatus="vs"> 
        <tr> 
         <td align="center"> 
                <html:text indexed="true" name="extras" property="description" size="40" maxlength="100" /></td> 
         <td align="center"> 
                <html-el:radio indexed="true" name="extras" property="operation" 
          value="<%= ExtraCostInvoice.CREDITOPERATION %>" 
          onclick="setPercentSymbol(${vs.index}, false); calcCustomerAmount();" />Déduction 
                <html-el:radio indexed="true" name="extras" property="operation" 
          value="<%= ExtraCostInvoice.REDUCTIONOPERATION %>" 
          onclick="setPercentSymbol(${vs.index}, true); calcCustomerAmount();" />Réduction 
                <html-el:radio indexed="true" name="extras" property="operation" 
          value="<%= ExtraCostInvoice.SUPPLEMENTOPERATION %>" 
          onclick="setPercentSymbol(${vs.index}, false); calcCustomerAmount();" />Supplément 
         </td> 
         <td align="center"> 
                <html:text indexed="true" name="extras" 
          property="strAmount" size="7" maxlength="6" onchange="calcCustomerAmount();" /> 
                <input type="text" id="extraSymbol<c:out value='${vs.index}'/>" value="&euro;" 
          readonly="readonly" size="1" style="border: none"> 
               </td> 
        </tr> 
       </c:forEach> 
</html:form> 

감사

답변

1

그것을 해결했습니다. 또한 할당 된 배열의 모든 요소를 ​​반복하고 reset 메서드에서 초기화해야한다고 밝혀졌습니다. 이 경우 ExtraInvoiceForm [] extraInvoiceForms은 모든 요소를 ​​초기화해야했습니다.