外键属性的EL测试表达式是什么?

时间:2017-03-07 00:35:10

标签: spring jsp jstl el

我有3个实体:

    @Entity
    @Table(name = "resultat")
    public class Resultat {

        @Id
        @SequenceGenerator(name="s_resultat", sequenceName="pta.s_resultat", allocationSize=1)
        @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="s_resultat")
        @Column(name = "result_code")
        private Integer code;

        @Column(name="result_intitule")
        private String lib;

        @ManyToOne
        @JoinColumn(name = "acti_code")
        private Activite activite;

        ...

    }

    @Entity
    @Table(name = "activite")
    public class Activite {

        @Id()
        @Column(name="acti_code")   
        private String code;

        @Column(name="acti_design")
        private String lib;

        @ManyToOne
        @JoinColumn(name = "action_code")
        private Action action;

        public Activite() {
            super();
        }

        ...

    }

@Entity
@Table(name = "action")
public class Action {

    @Id
    @SequenceGenerator(name="s_action", sequenceName="pta.s_action", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="s_action")
    @Column(name = "action_code")
    private Integer code;

    @Column(name="action_design")
    private String lib;

    ...

}

现在,我想显示两个实体ActiviteResultat的主 - 详细JSP页面。我创建了DAO返回Action列表,Activite列表和Resultat列表。并在控制器中调用它们以便传递给JSP。

在我的JSP中,我首先循环激活列表,然后循环结果列表:

<c:forEach items="${activites}" var="activite" varStatus="statusActivite">
     <c:forEach items="${resultats}" var="resultat">
          // here I want to test if resultat is the right foreign key for the actual activite
     </c:forEach>
</c:forEach>

那么如何将resultat变量的测试编写为与activite关联的外键?

0 个答案:

没有答案