This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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

Win a copy of Java 8 in Action this week in the Java 8 forum!
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
Similar Threads
Dynamically Adding Components
Dynamically create component from namespace and tag name
Dynamic Richfaces Tab Creation In Java Code ..How To Handle Create Event/Action
why JSF?
Not able to submit datatable