• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF form population

 
Kevin Taylor
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to provide edit capabilities for the application I am designing and I need a way to set all of the form fields based upon a querystring value passed into the page, an id field for a database row. Basically, it needs to pull this info. from a database and populate the form fields by the time the page loads. I am a little confused as to when and where in the lifecycle this should happen and what object I should do this in? Any help would be greatly appreciated. Maybe someone could suggest a book on JSF as well.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kevcpu

Welcome to Javaranch. We don't have too many rules around here but we do have a Naming Policy. Please adjust your display name to meet these requirements. Specifically your display name must consist of a first and last real sounding name.

You can change your display name by clicking here.

Thanks a bunch.
 
Sergey Smirnov
Ranch Hand
Posts: 167
 
Kevin Taylor
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I looked at the example on the site. What class is populatePanel() a member of or where should it be placed. Also, lets say I wanted to have the form components to populate as the page is loading with values retrieved from the database. The id value will be read in from the querystring.
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be placed in the backing bean of your page. The query paramenters are accessed using the Value Binding, for example.
Provide a component binding for you form component, first. The property of the backing bean that represent the component will be a root you can add children under.

--
Sergey http://jsfTutorials.net
 
Kevin Taylor
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I make this addition to the backing bean. Where in the lifecycle will this method get called? How do I let the page know to call this method before anything else occurs? Do you know of any examples that might demonstrate how this addition fits within the lifecycle? I am from a .net background and am trying to incorporate jsf into the services I provide.


Originally posted by Sergey Smirnov:
It should be placed in the backing bean of your page. The query paramenters are accessed using the Value Binding, for example.
Provide a component binding for you form component, first. The property of the backing bean that represent the component will be a root you can add children under.

--
Sergey http://jsfTutorials.net
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!