Manorrock.com / Demo JSF

JSF DOM List demo

How to get this working

To get this working on your own page, look below for the example snippet used to get the demo on this page working.
        <ui:repeat xmlns:dom="http://www.manorrock.com/jsf/dom"
          value="#{dom:list(domBean.listNode)}" var="item">
            <h:outputText value="#{dom:text(item)}"/> <br/>
        </ui:repeat>
                    
For the demo we need a DOM document that contains a list of nodes, the following code snippet is used to create such a simple document. It is a document that contains 3 nodes, {A, B, C}.
        /**
         * Get the DOM node for the list example.
         *
         * @return the list node.
         */
        public Node getListNode() {
            Node result = null;

            try {
                String xml = "<test><a>A</a><b>B</b><c>C</c></test>";
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document document = builder.parse(
                        new InputSource(new StringReader(xml)));
                result = document.getFirstChild();
            } catch (Exception exception) {
            }

            return result;
        }

                    

Actual demo

A
B
C

Up