我有以下(不言自明的)实体关系:
* Manufacturer
* Car (Manufacturer.getCars())
* Tire (Car.getTires())
豆豆
private List<Manufacturer> allManufacturers
private Manufacturer selectedManufacturer
private Car selectedCar
private Tire selectedTire
xhtml
<p:selectOneMenu id="manufacturerSel" value="#{myBean.selectedManufacturer}" converter="#{manufacturerConverter}">
<f:selectItem itemLabel="None" itemValue="#{null}" />
<f:selectItems value="#{myBean.allManufacturers}" />
<p:ajax update="carSel tireSel" />
</p:selectOneMenu>
<p:selectOneMenu id="carSel" value="#{myBean.selectedCar}" converter="#{carsConverter}" disabled="#{empty myBean.selectedManufacturer.cars}">
<f:selectItem itemLabel="None" itemValue="#{null}" />
<f:selectItems value="#{myBean.selectedManufacturer.cars}" />
<p:ajax update="tireSel" />
</p:selectOneMenu>
<p:selectOneMenu id="tireSel" value="#{myBean.selectedTire}" converter="#{tiresConverter}" disabled="#{empty myBean.selectedCar.tires}">
<f:selectItem itemLabel="None" itemValue="#{null}" />
<f:selectItems value="#{myBean.selectedCars.tires}" />
</p:selectOneMenu>
- 最后两个
p:selectOneMenu
应根据第一个中的选择进行更新 - 最后一个
p:selectOneMenu
IDtireSel
未正确更新 - 所有要更新的组件都在同一个内部
NamingContainer
- 得到
carSel
更新,但加载的值tireSel
很奇怪(似乎对最后一个请求有效) update="@form"
我也试过manufacturerSel
编辑 显示使用了哪个 EL 版本:这是我的 pom.xml 的摘录
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.12</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>