In this post I discuss how the ADF Binding Framework and the ADF Business Components Model can be used to import model-data as XML into a JSP and more specifically into JSTL-XML tags . It is largely based on the exchange I had with Steve Muench. The article proposes an alternative to the use of JSTL’s SQL tags to select data that is then transformed into XML Document variables within a JSP. This is an approach I used in several previous posts: SVG, XSLT and JSP/JSTL: Generating Digital Gauge or Speedometer Chart based on dynamic data, Generating SVG Graphics in JSPs using JSTL & XSL(T) – from MySQL to Bar Chart and Pie Chart and XSL Transforming XML generated from SQL results using JSTL tags in JSP pages – putting JSTL to the test.
We can make use of the writeXML() method on the ViewObject. This method returns an XML Document with the data from the current VO Row as well as all of its details through the ViewLinks defined for the ViewObject, for as many levels as is required.
Using ViewObject writeXML and JSTL XML Tag Library – Illustrates how to use the ViewObject writeXML() method to produce a multi-level XML message for an HR schema-based data model having Departments -> EmployeesInDepartment -> DirectReports->DirectReportJobHistory with a second detail collection under Departments of Deparments -> EmployeesJobHistory. This XML document is then set as a request attribute so that the JSTL XML library can render the multi-level information using XPath expressions. The sample contains both Struts and Model 1 examples (requires the HR schema).