Hey there,
Suppose you have a Stateful bean called "PersonManager" that handles both the CRUD and search features for the "Person" entity. I'm using Session scope. I have the following in the "PersonManager"
@DataModel
List<Person> people;
@DataModelSelection
Person selectedPerson;
// Person property
private Person person;
public void setPerson(Person person) { this.person = person; }
public Person getPerson() { return person; }
public void clickPerson() {
person = selectedPerson;
return "edit";
}
When I display a clickable data table with a command link to clickPerson, the selectedPerson
does get injected into the PersonManager. I then assign this to the "person" property. Now if I go to a page to edit the Person, expressions like #{personManager.person.firstName} fails. HOWEVER, if I use an expression like #{personManager.selectedPerson.firstName} it works.
Why doesn't it stick when I copy the selectedPerson to the property?
-Michael
PS: I'm using the edit page to also create new people. This is why I wanted to bind the edit page to a property and not a selected item.