• Post Reply Bookmark Topic Watch Topic
  • New Topic

<c:if vs rendered attribute  RSS feed

 
Ashish Bassi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was using rendered attribute in one of the inputText tags like


i noticed that the getter for permission property gets invoked about 4 times, so i used c:if instead


With this the getter of permission property gets invoked only once.

Based on this, should i conclude that using c:if is a better alternative than rendered attribute? Or are there situations where using rendered attribute for displaying/hiding controls would be more useful
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use JSTL, JSF won't be properly aware of what you're doing to the View structure.

Also, there's a reason why the setter gets called multiple times, so there's a strong possibility that you're short-circuiting parts of the JSF lifecycle on that control.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!