Reputation: 295
Car.java
@ManagedBean
@ViewScope
public class Car{
private List<Wheel> wheels;
@PostConstruct
public void init(){
wheels = new Arraylist<>();
}
public void setWheels(List<Wheel> wheels){
this.wheels = wheels;
}
public List<Wheel> getWheels(){
return wheels;
}
}
TestPage.xhtml :
<h:form>
<p:selectOneMenu value = "#{car.wheels}">
<f:selectItems ... />
</p:selectOneMenu>
</h:form>
When page is rendered javax.propertyNotFoundException on #{car.wheels}
is shown
When i changed the name of wheels to c the page is rendered correctly
This exception happens a lot without knowing the problem
Am i missing something
Upvotes: 0
Views: 90
Reputation: 4886
provide a name for the managed bean
@ManagedBean(name="carss")
and access using that name
<p:selectOneMenu value = "#{carss.xxxx}">
Upvotes: 0
Reputation: 5307
Pretty sure you mean
<h:selectOneMenu value="#{car.selectedWheel}">
<f:selectItems value="#{car.wheels}" var="wheel" itemLabel="#{wheel.making}" />
</h:selectOneMenu>
For selecting several values at once have a look at h:selectManyListBox.
Upvotes: 1