Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

application.createComponent vs Constructor

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

should I use this way:



or that way:


which way is better (difference?)
[ August 19, 2008: Message edited by: nimo frey ]
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Application#createComponent() is JSF implementation dependent. It might for example either return just HtmlOutputText or another component which extends HtmlOutputText. You for one can also have extended HtmlOutputText and if you want to use it in the createComponent() instead, then you can use Application#addComponent() for it.

If you don't need it all, then just instantiating it plain is sufficient and it is performancewise also a bit faster.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic