private String stheme;
private String slevel;
private Double spyPrice;
private Double setPrice;
private Set<SceneryPic> sceneryPics=new HashSet<SceneryPic>();以上是这个pojo的所有字段,是Hibernate的一对多关系,这是一的一方,查询出来的一方是List<pojo> 我要取到这个pojo的对应的多方也就是这个Set<>
要获得这个Set<>的sceneryPics中的第一个,用EL表达式不管是Foreach还是iterator,只要出来就好。页面是JSP的

解决方案 »

  1.   

    这样试试!
    <c:forEach items="${list}" var="pojo">
       <c:forEach items="${pojo.sceneryPics}" var="sceneryPic">
          ${sceneryPic}
       </c:forEach>
    </c:forEach>
      

  2.   

    这个sceneryPic有多个啊,发愁,我只要一个
      

  3.   

    获取第一个的话<c:forEach items="${pojo.sceneryPics}" begin="0" end="1" var="sceneryPic">这样试试!
    HTML code
    <c:forEach items="${list}" var="pojo">
       <c:forEach items="${pojo.sceneryPics}" var="sceneryPic">
          ${sceneryPic}
       </c:forEach>
    </c:forEach>
    [/Quote]