I've got JavaServer Faces to work now with the following :
in the class Company I have :
The list has objects :
in MyConverter :
What happens in System.out :
The index.xhtml is loaded and this happens
INFO: ctor
INFO: getAsString() Person lastName value : Adams
INFO: getAsString() Person lastName value : Bumstead
INFO: getAsString() Person lastName value : Chester
I select the
second on the list and nothing is added here
Then I press commandButton and the following happens
INFO: MyConverter.getAsObject() value : Bumstead
INFO: ctor // just kills the selection I made !!!
INFO: doSomething selectedPerson = null
INFO: getAsString() Person lastName value : Adams
INFO: getAsString() Person lastName value : Bumstead
INFO: getAsString() Person lastName value : Chester
Now, when the command button is pressed,
the routine getAsObject(...) in MyConverter is called.
I presume that there I'm supposed to come up with a Person object as a return value of getAsObject
which corresponds to the "Bumstead"
string I selected in the list.
I need a handle to the Company instance but these two arguments,
javax.faces.context.FacesContext context and
javax.faces.component.UIComponent component are vague and don't help at all.
In getAsObject() how can I access the Company instance so that I can access the persons list so that I can
access the Person object the label and value are pointing to?