Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SelectOneMenu always set 0 in backing bean property  RSS feed

 
Rex Zkachvi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing a lazy table pagination with JSF and JPA. The idea is select how many rows per page the datatable show through a <h:selectOneMenu ... /> and AJAX, but when I select a value (5, 10, 15, 20, 25) the backing bean property is set to 0. I thought the problem was to convert to integer, but after put converter="javax.faces.Integer" the problem still there.

View


Bean


Why is this happening?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Express "itemsPerPage" as a read/write public property of userPaginatorBean. That is, add integer-value get/set methods to access the property's internal value.

That's it! You don't even need an AJAX listener method as long as "itemsPerPage" is also used to set the items-per-page attribute of the dataTable.

All the AJAX tag needs to do is cause the dataTable to be re-rendered. It will pick up the new itemsPerPage value automatically.
 
Rex Zkachvi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim, thank you for reply. Already have getters/setters for itemsPerPage property. The idea behind the listener is because in that method i'll fetch more records from database.



After that, the datatable must be re-rendered to show the new users collection. I've tried without the listener to probe the itemsPerPage value is set correctly, but the result is the same, still setting 0.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!