For the first thing, FacesContext.getCurrentInstance.getApplication().createComponent(String type) method will do the job.
For the second thing, facelets is another solution for templating and composition from templates.
Cagatay
On 6/16/06, Phanidhar Adusumilli <[EMAIL PROTECTED]> wrote:
The class UIComponentTag has a method createComponentInstance. This method is private. If this method is protected one can override this and provide alternative creation mechanism.One example can be, clay api can be used to create a component and its children from a template. Thus using these templates will make JSP code simpler.I would appreciate others opinion on this.

