2012-01-09 2 views
0

Struts 1 양식에 문제가 있습니다. 논리가 포함되어 있습니다. 입력 버튼이있는 행을 작성하는 과정을 반복합니다.Struts 1 - 행 제출

<html:form action="/myAction" styleClass="centeredForm" style="display:inline" > 
    <td class="formLabel">City</td> 
    <td class="formControl"> 
    <bean:define id="cities" name="myForm" 
       property="cities" type="java.util.Collection"/> 
    <html:select styleClass="dashSelect" property="city"> 
     <html:option value="">All Cities</html:option> 
     <html:options collection="cities" 
        property="id" labelProperty="value"/> 
    </html:select> 
    </td> 

    ... Other elements ... 

    <logic:iterate id="myObject" name="myForm" property="myObjects" indexId="index" type="com.test.MyObject"> 
     <% String rowClass = index.intValue() % 2 == 0 ? "even-row" : "odd-row"; %> 
    <tr class="<%=rowClass%>"> 
     <td class="result-cell"><bean:write name="myObject" property="id" />&nbsp;</td> 
     <td class="result-cell"><bean:write name="myObject" property="name" />&nbsp;</td> 
     <td class="result-cell"> 
     <html:select styleClass="dashSelect" name="myObject" property="status"> 
      <html:option value="F">Disabled</html:option> 
      <html:option value="T">Enabled</html:option> 
     </html:select> 
     </td> 

     <td> 
     <html:submit/> 
     </td> 

은 "도시"부분과 : I 버튼을 제출 그 중 하나를 쳤을 때 문제가 온다, 동적 데이터가 제대로 배치되지 않는 양식은 그 가치가없는, 여기 예제 논리 외부에서 쉬어 라. "myForm"을 잘 반복해라. 그러나 "myObject"는 그렇지 않다. JavaScript 함수를 사용하여이 작업을 시도했지만 제대로 작동하지 못했습니다. 현재, 내가 가지고있는 것 (그 html : 레퍼런스로 남겨둔 제출)은 POST에 "상태"매개 변수와 내가 전에 언급 한 적절한 값을 포함하고 있습니다.

누구든지이 문제에 대해 의견을 개진 할 수 있습니까?

추가 정보가 필요하면 알려주십시오.

미리 감사드립니다.

+0

무슨 뜻인지 확실하지 않습니다. 당신은'indexed' 태그 ([here] (http://struts.apache.org/1.2.7/faqs/indexedprops.html) 참조) 나 중첩 된 태그를 사용하지 않고 수동으로 인덱스 된 속성 이름을 만들지 않습니다. 그래도 작동하지 않는 것에 대해서는 완전히 명확하지 않습니다. (태그/콩 중 일부에서 많은 노력이 필요해 보이지만, 오래된 컨테이너를 사용하는 경우 JSP EL 또는 적어도 EL Struts 태그를 사용 해본 적이 있습니까?) –

+0

문제는 제출하면 양식에 "myObject"가 채워지지 않습니다. 논리는 반복을 통해 만드는 모든 행에 대한 정보입니다. 그동안 색인 생성 된 태그를 살펴 보겠습니다. – LdSe

답변

0

, 방금 논리 내부의 양식을 사용했습니다.

감사합니다.

0

논리 반복 : 시도해보십시오. 도움이 될 것입니다. 반복,을 해당 속성에 인덱스를 추가하고 나머지를 얻기 위해 자바 스크립트 기능을 사용하는 대신 하나의 양식을 사용

<logic:iterate name="myForm" property="myObjects" id="myObjects" indexId="true"> 
    <tr> 
    <td class="result-cell"><bean:write name="myObjects" property="id" />&nbsp;</td> 
     <td class="result-cell"><bean:write name="myObjects" property="name"/>&nbsp;</td> 
     <td> 
     <html:submit/> 
     </td>  
    </tr> 
</logic:iterate> 
+0

Hello subodh, 불행히도 bean : write는 값 또는 인덱스 된 속성을 가지고 있지 않습니다. : 다른 것을 사용하려는 의미가 있습니까? 답장을 보내 주셔서 감사합니다. – LdSe

+0

오 !! 그렇다면 값을 사용하고 색인을 생성하지 않으면 속성이 오류를 나타내거나 출력이 무엇입니까? 내 업데이트 대답은이 작업을 시도하고 여전히 문제가 있으면 알려주십시오. – subodh