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

Display just a datatable is a faces request?  RSS feed

 
Jorge Martinez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hy,

1. If we have and xhtml page and we just have a datatable to show some records through a managed bean, I think there is no validation phase, apply request values phase... so it would be a faces request but not with the lifecycle of a jsf request, right?

2. In the previous case because the normal phases of a jsf request are not going to be called, the method that will be called in the backing bean to get the records, could be called more than once although its not a normal faces request?

Thanks
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSF lifecycle is not that variable. If you submit a form, it will go through validation phase, even if there is no data in the form. However, only submitted data ever gets validated, regardless.

Don't assume you know how many times the property get and set methods will be invoked. Period. Regardless of whether there's form data or not. It's not guaranteed to be a fixed constant, and even if it appears to be so today, it may not be so tomorrow. To say nothing of how easy it would be to break something when someone comes in later and makes "just one small change".
 
Dieter Quickfend
Bartender
Posts: 543
4
Java Netbeans IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use the "immediate" attribute to bypass your process validations and update model phases, but it can be kind of iffy, especially if you do have information to pass to the page you need. I would recommend not tampering too much with JSF internals. Unless you get validation-specific errors, or you see it's a performance bottleneck at that location, I wouldn't use it.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed. Here's a good map of the lifecycle. Assume undocumented deviations at your peril:



developersbook.com JSF Lifecycle
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!