小编use*_*609的帖子

有关在ui:repeat中呈现的子类的PropertyNotFoundException

我有一个超类Person:

public class Person {
    public abstract Type getType();
}
Run Code Online (Sandbox Code Playgroud)

我有2个子类:

public class JuridicalPerson extends Person {
    public Type getType() {
        return Type.JP;
    }
    public List<JuridicalBelong> getJuridicalBelongs() {
        return juridicalBelongs;
    }
}
Run Code Online (Sandbox Code Playgroud)
public class NaturalPerson extends Person {
    public Type getType() {
        return Type.NP;
    }
    public List<NaturalBelong> getNaturalBelongs() {
        return naturalBelongs;
    }
}
Run Code Online (Sandbox Code Playgroud)

JuridicalBelongNaturalBelong具有不同的属性,不能被子类化.

我将它们放在List<Person>JSF/Facelets中,如下所示:

<ui:repeat value="#{bean.persons}" var="person">
    <h:panelGroup rendered="#{person.type eq 'JP'}">
        <ui:repeat value="#{person.juridicalBelongs}" var="juridicalBelong">
            ...
        </ui:repeat>
    </h:panelGroup>
    <h:panelGroup rendered="#{person.type eq 'NP'}">
        <ui:repeat …
Run Code Online (Sandbox Code Playgroud)

jsf conditional el jsf-2 uirepeat

4
推荐指数
1
解决办法
625
查看次数

标签 统计

conditional ×1

el ×1

jsf ×1

jsf-2 ×1

uirepeat ×1