4 Replies Latest reply on Feb 6, 2007 9:58 PM by Daniel Spangler

    composite ui component

    Daniel Spangler Newbie

      This may be the wrong forum, but if someone could direct me to the proper place that would be excellent.

      I would like to write a component that can dynamically link in other pre-configured jsf tags. When everything is linked in, I'd like everything to be treated as a single component within the same conversation so I can take advantage of all of seams injection facilities.

      Thanks,

      Daniel

        • 1. Re: composite ui component
          Pete Muir Master

          Can you give an example of what you are hoping to do (I'm not quite following you) - I think you may be confused between Seam components and JSF components?

          • 2. Re: composite ui component
            Daniel Spangler Newbie

            No, I think you might be right about it being more of a jsf question. I was just hoping someone could help me here.

            I'd like to do something like this in my page:

            <h:form>
             <z:mycomponent config="#{customer.config}"/>
             <h:commandButton value="Ok" action="doAuthenticate"/>
            </h:form>
            


            I'd then like based off of the configuration given to the component to contain the following two groups of child components:
            <!-- Snippet Group 1: -->
             <h:outputText value="Account Number:"/>
             <h:inputText value="#{payment.accountNumber}" id="accountNumber" required="true">
             <s:validate/>
             </h:inputText>
             <h:message for="accountNumber" />
             <br/>
            
            <!-- Snippet Group 2: -->
             <h:outputText value="PIN:"/>
             <h:inputText value="#{payment.pinNumber}" id="pinNumber" required="true">
             <s:validate/>
             </h:inputText>
             <h:message for="pinNumber" />
             <br/>
            


            I know I could render the html for the child snippets, but I'd like to re-use the jsf components so that I can take advantage of the databinding. Ideally I'd like to store the snippets in individual jspx files and dynamically link them into my component at runtime.

            I'm kind of new to jsf/seam so I apologize if this is the wrong place or I'm missing something really obvious here.

            Thanks,

            Daniel

            • 3. Re: composite ui component
              Pete Muir Master

              You should look at facelets (source) components - ah but you seem to be using jsp - my advice is don't, use facelets.

              If you used facelets source components, and used it as described in your first code snippet, you would have be able to access a #{config} object in your source components.

              • 4. Re: composite ui component
                Daniel Spangler Newbie

                Thanks a lot. Facelets is exactly what I needed.