多层迭代,List 中嵌套bean应如何写?

本文探讨了在JSP中使用多层迭代处理List中嵌套Bean的问题,并给出了具体的代码示例。作者遇到了关于获取Bean属性的异常,寻求正确的迭代方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

jsp:

 <logic:present name="saleOppForm" property="lstRummeryQuote" scope="request">
   <logic:iterate id="rummeryQuote" name="saleOppForm" property="lstRummeryQuote" indexId="rowIndex">
    <tr>
       <logic:iterate id="column" name="rummeryQuote" property="rowRummeryQuote" indexId="columnIndex">
             <td width="98" valign="top" class="whitetd"><html:text property="useRoomCount" size="10"></html:text></td>
             <td width="98" valign="top" class="whitetd"><html:text property="sumRoomPrice" size="10"></html:text></td>
    <td width="91" id="tdFunction0" class="whitetd">
     <!-- <input type='button' onClick='deleteRow(0)' id="btnDelRow000" class='btnDel'> -->
     <html:button onclick="createRow()" property="btnCreateRow" styleClass="btnCreate">
     </html:button>
    </td>
      </logic:iterate>
    </tr>
  </logic:iterate>
 </logic:present> 

SaleOppForm;

 private List lstRummeryQuote;
 public SaleOppForm() { 
  lstRummeryQuote  =  new  ArrayList(); 
        //页面初始显示一行
  lstRummeryQuote.add(rowRummeryQuote);
  //lstRummeryQuote.add(new  RowRummeryQuote());
 }

RowRummeryQuote(dataset):


 private String useRoomCount;
 private String sumRoomPrice;

异常:javax.servlet.ServletException: No getter method for property rowRummeryQuote of bean rummeryQuote

多层迭代,List 中嵌套bean,这样迭代不对吗?应如何写呢?请高手指教

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值