JDBC mediator integration with presentation layer

The JDBC Data Mediator Service (DMS) can be used in conjunction with Web application presentation layer technologies such as JavaServer Pages Standard Tag Library (JSTL) and JavaServer Faces (JSF). A general understanding of both of these technologies is assumed for this section. In particular for JSF, the UIData component and the general file structure of a JSF dynamic Web application should be known. For a brief overview of both JSF and JSTL refer to the links at Service Data Objects: Resources for learning.

The JDBC DMS and JSTL work well together because the JSTL access code is equivalent to the code necessary to access attributes and lists inside of a DataObject. For example, in relation to a root Customer DataObject, the JSTL expression

${rootDO.CUSTOMER[index].CUSTNAME}
is equivalent to the Java code for a DataObject of

rootDO.getList("CUSTOMER").get(index).get("CUSTNAME")
The reason for this is the dot notation in the JSTL expression language correlates to a getter() method in Java code, and the bracket notation allows you to access elements inside a list.

The JDBC DMS and JSF fit well together because the DataGraph produced by the JDBC DMS is able to populate a JSF UIData component without having to be transformed. The UIData component uses a dataTable tag that takes a list as its input to populate the table. This works out well with the DataGraph because all we need to pass into the dataTable is the root list of the DataGraph. The most common way to lay out the DataGraph in the dataTable is to display each attribute of the DataObject from the list retrieved from the root in its own column, and to embed each additional relationship to the DataObject in a new dataTable contained within the parent DataObject’s row. Using this method instead of a traditional ResultSet table eliminates duplicate information and makes it easier to see the separation of the parent object’s children. An example of how the Customer and Order scenario is laid out in a dataTable is shown in Example: JavaService Faces and JDBC Mediator

 

See also


Example: JavaService Faces and JDBC Mediator