当我将值设置为{zdsqlBean.zdljs}
时,我可以获得我想要的结果。
<h:outputLabel value="#{msgs.zdlj}" style="font-weight:bold" />
<p:selectOneMenu id="zdlj2" value="#{zsjBean.zdlj}">
<f:selectItems value="#{zdsqlBean.zdljs}" var="bll4"
itemLabel="#{bll4.descri}" itemValue="#{bll4.value}" />
</p:selectOneMenu>
但是当我将值设置为 时{zdsqlBean.thszfas}
,我无法得到我想要的结果。
<h:outputLabel value="#{msgs.zdlj}" style="font-weight:bold" />
<p:selectOneMenu id="zdlj2" value="#{zsjBean.zdlj}">
<f:selectItems value="#{zdsqlBean.thszfas}" var="bll4"
itemLabel="#{bll4.descri}" itemValue="#{bll4.value}" />
</p:selectOneMenu>
为什么?以下是zdsqlBean
:
@ManagedBean(name = "zdsqlBean")
@SessionScoped
public class ZdsqlBean {
private List<Zdsql> zdsqls;
private List<Zdsql> zdljs;
private List<Zdsql> thszfas;
public ZdsqlBean(){
this.genzdljs();
this.getThszfas();
}
public List<Zdsql> getZdsqls() {
return zdsqls;
}
public List<Zdsql> getThszfas() {
System.out.println("zdsqls1==");
return thszfas;
}
public List<Zdsql> getZdljs() {
return zdljs;
}
public void genzdljs() {
try {
String queryString = "select m from Zdsql m where m.filter = :filter Order by m.id";
TypedQuery<Zdsql> query = DBDAO.getEntityManager().createQuery(
queryString, Zdsql.class);
query.setParameter("filter", "zdlj");
System.out.println("zdsqls1==");
zdljs = query.getResultList();
} catch (Exception re) {
DBDAO.log("genzdljs() failed", Level.SEVERE, re);
}
}
public void genthszfas() {
try {
System.out.println("zdsqls1`1==");
String queryString = "select m from Zdsql m where m.filter = :filter Order by m.id";
TypedQuery<Zdsql> query = DBDAO.getEntityManager().createQuery(
queryString, Zdsql.class);
query.setParameter("filter", "thszfas");
System.out.println("zdsqls12==");
thszfas = query.getResultList();
} catch (Exception re) {
DBDAO.log("genthszfas() failed", Level.SEVERE, re);
}
}
}