【问题标题】:List not displaying the properties even with size 0即使大小为 0,列表也不显示属性
【发布时间】:2015-04-12 02:35:58
【问题描述】:
List<Object> result = (List<Object>)guestSession.Available_RoomType(startDateString, endDateString, name);

             List<Roomtype> new_room;
                            List<? extends Object> list = result;
                            new_room = (List<Roomtype>) list;

    %>
    <table>
        <%if(new_room!=null){
                            for(Roomtype r : new_room){%>
        <tr>

            <td><%= r.getName() %></td>
            <td><%= r.getDescription() %></td>
            <td><%= r.getPrice() %></td>
        </tr>

   <%}
        }%>
    </table><%
        }
    %>

new_room 的大小在我调试时为 0,但属性未显示。编译器会跳转tr 中的所有内容。请为此提供任何理由,因为之后页面变为空白。

【问题讨论】:

    标签: java


    【解决方案1】:

    首先,请不要使用小脚本。二、

    List<Roomtype> new_room = (List<Roomtype>) guestSession.Available_RoomType(
            startDateString, endDateString, name);
    %>
    <table>
        <% if(new_room != null) {
           for(Roomtype r : new_room){%>
    

    最后,我建议你看看&lt;c:forEach&gt;,因为它支持迭代集合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-11
      • 2012-10-25
      相关资源
      最近更新 更多