As a best practice, your application should have modular renderers to handle the response model for each content item.

A typical page consists of a content item that contains several child content items representing the individual feature cartridges. The Discover Electronics application maps each response model to the proper renderer by convention, based on the @type. The model @type corresponds to the template identifier (the directory name) of the template that was used to configure it. (Recall that the template type determines where a cartridge can be placed in another content item, while the template ID uniquely identifies the cartridge and its associated content definition.) For each cartridge, the associated renderer is located in WEB-INF/views/<channel>/<TemplateID>/<TemplateID>.jsp. For example, the renderer for the Breadcrumbs cartridge is located in WEB-INF/views/desktop/Breadcrumbs/Breadcrumbs.jsp.

In the Discover Electronics application, this logic is implemented in include.tag. Your application should implement a similar mapping of response models to their corresponding rendering code.

Source code for the renderers in the Discover Electronics application is provided as an example of how to work with the model objects returned by the Assembler in Java. The sample rendering code is intentionally lightweight, enabling it to be more easily customized for your own site. For information about the response models for the core cartridges, refer to the Assembler API Reference (Javadoc).

Some features in the Discover Electronics application are designed with certain assumptions about the data set, such as property and dimension names. Mirroring the Discover Electronics data schema for your own data can facilitate reuse of the reference cartridges, reducing the need to update rendering logic and Assembler configuration for your data set.

As soon as you have retrieved the necessary information for your page, Oracle recommends subdividing your view logic to correspond to the hierarchy of content items returned by the Assembler.

The renderer for the Three Column Navigation Page content item in Discover Electronics provides an example of the page rendering process as implemented in the reference application. It is located in your Tools and Frameworks installation directory under reference\discover-electronics-authoring\WEB-INF\views\desktop\ThreeColumnPage\ThreeColumnPage.jsp. You can use this JSP file as a point of reference for developing your own application pages. While the details are specific to the Discover Electronics implementation of the Assembler API, your general approach should be similar.

Recall that each of the <div> elements that make up the page uses a custom <discover:include> tag, defined in WEB-INF\tags\discover\include.jsp, to include the rendering code for the associated page component:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <!-- Additional elements removed from this sample -->
</head>
<body>
    <endeca:pageBody rootContentItem="${rootComponent}">
        <div class="PageContent">
            <%--include user panel --%>
            <%@ include file="/WEB-INF/views/userPanel.jsp" %>
            <%--include user page logo --%>
            <%@ include file="/WEB-INF/views/pageLogo.jsp" %>
            <div class="PageHeader">
                <c:forEach var="element" items="${component.headerContent}">
                    <discover:include component="${element}"/>
                </c:forEach>
            </div>
            <div class="PageLeftColumn">
                <c:forEach var="element" items="${component.leftContent}">
                    <discover:include component="${element}"/>
                </c:forEach>
            </div>
            <div class="PageCenterColumn">
                <c:forEach var="element" items="${component.mainContent}">
                    <discover:include component="${element}"/>
                </c:forEach>
            </div>
            <div class="PageRightColumn">
                <c:forEach var="element" items="${component.rightContent}">
                    <discover:include component="${element}"/>
                </c:forEach>
            </div>
            <div class="PageFooter">
                <%--include copyright --%>
                <%@include file="/WEB-INF/views/copyright.jsp" %>
            </div>
        </div>
    </endeca:pageBody>
</body>
</html>

For the example above, the JSP is composed as follows:


Copyright © Legal Notices