Meaningless Drivel is fun!
The moose likes JSF and the fly likes application.createComponent vs Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "application.createComponent vs Constructor" Watch "application.createComponent vs Constructor" New topic

application.createComponent vs Constructor

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580

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

Joined: Oct 08, 2006
Posts: 2458
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.
I agree. Here's the link:
subject: application.createComponent vs Constructor
It's not a secret anymore!