有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何使用c:foreach列出另一个类中的对象列表。

我的一个对象中有另一个对象的列表。我怎样才能把超人名单拿出来。任何想法或帮助都将不胜感激。谢谢

 <table id="contactTable" class="table table-hover" >
     <tr>
         <th width="10%">Date</th>
         <th width="10%">Supers</th>
         <th width="50">Location Seen</th>
         <th width="20%"></th>
         <th width="30%"></th>
     </tr>
     <tr>
       <td>
            Date: <c:out value="${sighting.date}"/>                
        </td>
        <td>
            Super Person: <c:out value="${sighting.superPerson.name}"/>
        </td>
        <td>
          Location: <c:out value="${sighting.location.locationName}"/>
        </td>
        </table>


   //class
     public class Sighting {
     private int sightingId;
     private String sighting;
     private String description;
    @DateTimeFormat(iso = ISO.DATE)
     private LocalDate date;
     private Location location;
     private List<SuperPerson> superPerson = new ArrayList<>();

共 (1) 个答案