• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF 2.0 MyConverter.getAsObject(...) how to get a handle on the backing bean

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Dave Elwood
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found it, this is how to find the instance of Company....





 
reply
    Bookmark Topic Watch Topic
  • New Topic