• Post Reply Bookmark Topic Watch Topic
  • New Topic

How t:datatable works and when bean will be initialised?  RSS feed

 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm bit confused to use t:dataTable to get the list of rows from the database.
Below is part of my bean class to return the approved list.


and the following is my datatable on jsf design

The problem is, when i load the page first time, everything is populated properly.
I have link on id column and if i click to select, the datatable calls getLeaveAppliedList()
again and that time my emp.getEmployeeId is null. I don' know why and how.
I initialised this emp in the constructor like below:

Instead of this, if I declare like below:

seems to have empId. I know its basically some design and the flow issue. Can any one please point out this.
Thanks for your time.
 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to add that, the bean is request scoped.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhamayanthi Karuppanan wrote:Forgot to add that, the bean is request scoped.


DataTables and Request scope don't work well together. If you're using JSF2, you should move up to View scope. For JSF1, you'll have to go all the way up to Session scope.

Request scope objects are destroyed and re-created on each submit, so they can't carry over data from one request to the next.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!