Example: JavaService Faces and JDBC Mediator
This code would be located inside of a Faces JSP page. It contains the UIData component dataTable tag with all of the customer’s information, along with their orders. Each Customer attribute has its own column. The Customer Orders are embedded in another dataTable containing each of the Order attributes in separate columns. This embedded dataTable of Orders is like any other Customer attribute, having its own column inside each Customer row.
<h:dataTable value=">{pc_Customers.customer}" var= "varcustomer" styleClass="dataTable"> <h:column id="column1"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Customerid" id= "text1"></h:outputText> </f:facet> <h:outputText id="text2" value=">{varcustomer.CUSTOMERID}" styleClass="outputText"> <f:convertNumber /> </h:outputText> </h:column> <h:column id="column2"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custfirstname" id="text3"></h:outputText> </f:facet> <h:outputText id="text4" value=">{varcustomer.CUSTFIRSTNAME}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column3"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custlastname" id="text5"></h:outputText> </f:facet> <h:outputText id="text6" value=">{varcustomer.CUSTLASTNAME}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column4"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custstreetaddress" id="text7"></h:outputText> </f:facet> <h:outputText id="text8" value=">{varcustomer.CUSTSTREETADDRESS}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column5"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custcity" id="text9"> </h:outputText> </f:facet> <h:outputText value=">{varcustomer.CUSTCITY}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column6"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custstate" id= "text11"></h:outputText> </f:facet> <h:outputText value=">{varcustomer.CUSTSTATE}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column7"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custzipcode" ></h:outputText> </f:facet> <h:outputText value=">{varcustomer.CUSTZIPCODE}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column8"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custareacode" ></h:outputText> </f:facet> <h:outputText value=">{varcustomer.CUSTAREACODE}" styleClass="outputText"> <f:convertNumber /> </h:outputText> </h:column> <h:column id="column9"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Custphonenumber" ></h:outputText> </f:facet> <h:outputText value=">{varcustomer.CUSTPHONENUMBER}" styleClass="outputText"> </h:outputText> </h:column> <h:column id="column10"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Customers_orders" ></h:outputText> </f:facet> <h:dataTable value=">{varcustomer.CUSTOMERS_ORDERS}" var="varCUSTOMERS_ORDERS" styleClass="dataTable"> <h:column id="column11"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Ordernumber" ></h:outputText> </f:facet> <h:outputText value=">{varCUSTOMERS_ORDERS.ORDERNUMBER}" styleClass="outputText"> <f:convertNumber /> </h:outputText> </h:column> <h:column id="column12"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Orderdate" ></h:outputText> </f:facet> <h:outputText value=">{varCUSTOMERS_ORDERS.ORDERDATE}" styleClass="outputText"> <f:convertDateTime /> </h:outputText> </h:column> <h:column id="column13"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Shipdate" ></h:outputText> </f:facet> <h:outputText value=">{varCUSTOMERS_ORDERS.SHIPDATE}" styleClass="outputText"> <f:convertDateTime /> </h:outputText> </h:column> <h:column id="column14"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Customerid" ></h:outputText> </f:facet> <h:outputText value=">{varCUSTOMERS_ORDERS.CUSTOMERID}" styleClass="outputText"> <f:convertNumber /> </h:outputText> </h:column> <h:column id="column15"> <f:facet name="header"> <h:outputText styleClass="outputText" value="Employeeid" ></h:outputText> </f:facet> <h:outputText value=">{varCUSTOMERS_ORDERS.EMPLOYEEID}" styleClass="outputText"> <f:convertNumber /> </h:outputText> </h:column> </h:dataTable> </h:column> </h:dataTable>