2014-10-09 78 views
0

我有下面的代码,testresultlists是一个转移到JSP的列表,并且id被命名为row。问题是在选择迭代器期间我无法获得每行的resultTypeId。 在这个<s:if test="%{#result.resultTypeId == #row.resultTypeId">我尝试了很多方法,找不到工作方式来显示#row.resultTypeId结果,但它在另一个区域显示值。 任何人都可以帮助我吗?JSP Struts参数未显示

<display:table name="testresultlists" class="mobile" id="row" style="width:100%;" 
    cellpadding="0" cellspacing="0" pagesize="50" requestURI="testExecutionAction.action" sort="external"> 
    <display:caption><thead> 
    <tr class="pageHeader"> 
     <th style="width: 5%;" >No.</th> 
     <th style="width: 25%;">Test Case Name</th> 
     <th style="width: 10%;">Result</th> 
     <th style="width: 25%;">Log</th> 
     <th style="width: 10%;">Bug Id</th> 
     <th style="width: 25%;">Comments</th> 
    </tr> 
    </thead></display:caption> 
    <display:column title="Row Number" class="fixTitle1"> 
     <c:out value="${row_rowNum}"></c:out> 
    </display:column> 
    <display:column property="testCaseName" /> 
    <display:column title="Row Number" class="fixTitle1"> 
     <select id="${row.resultId}" name="${row.resultTypeId}"> 
     <s:iterator value="#resulttypelist" id="result"> 
      <s:if test="%{#result.resultTypeId == #row.resultTypeId"> 
       <option value="${result.resultTypeId }" selected="selected">${result.resultTypeName}</option> 
      </s:if> 
      <s:else> 
       <option value="${result.resultTypeId }">233${result.resultTypeName}</option> 
      </s:else> 
     </s:iterator> 
     </select> 
    </display:column> 
    <display:column property="resultTypeId" /> 

回答

0

如果在动作类变化为resulttypelist一个getter这个代码

<s:iterator value="resulttypelist" var="result"> 
    <s:if test="%{#result.resultTypeId == #attr.row.resultTypeId}"> 
     <option value="${result.resultTypeId}" selected="selected">${result.resultTypeName}</option> 
    </s:if> 
    <s:else> 
     <option value="${result.resultTypeId}">233${result.resultTypeName}</option> 
    </s:else> 
</s:iterator> 
+0

非常感谢您!它完全为我工作。 – 2014-10-10 11:57:31