Create UIComponent from a ui:composition

View: New views
1 Messages — Rating Filter:   Alert me  

Create UIComponent from a ui:composition

by lightbulb432 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've got a series of components defined in a facelets xml file, in the form of a ui:composition that contains a few other components. Is there any way to access programmatically the components in that xml file? For example,

myform.xml:

<ui:composition>
  <h:form>
    <h:inputText ... />
    <h:commandButton ... />
  </h:form>
</ui:composition>

Code:

UIComponent myComponent = getUIComponentFromFaceletXML("/myform.xml");

Does such functionality exist? (I imagine it would because I'm guessing Facelets itself would need to turn xml files into UIComponents.) Or could someone point me in the direction of how to do it? The idea is to define certain sets of components in xml files, then access those components programmatically for use within other custom components.

What code could you use to get access to the myComponent above, and would it refer to the ui:composition itself, or to the h:form immediately underneath it? Thanks.