Skip Headers
Oracle® Fusion Middleware Content Management Guide for Oracle WebLogic Portal
10g Release 3 (10.3.2)

Part Number E14230-01
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

11 Using Display Templates

Display templates allow you to create standard views for portal content that you can use within your JSPs using display template JSP tags. For example, if your portal displays a list of books, you can create display templates that determine how the list of books is presented. Or you can create display templates that configure how an employee directory of pictures are presented.

Content management features such as the Content Presenter portlet and syndication feeds use display templates to present content to users. You can customize these templates or add new ones to extend these features.

This chapter includes the following topics:

11.1 Using Display Template JSP Tags

You use display template JSP tags to call display templates within your portal. Display templates are JSPs that you create that dictate how content is presented. After creating a display template, you register it with a wlp-template-config.xml file. After a display template (JSP) has been created and registered correctly, you can use it within a JSP using display template JSP tags.

WebLogic Portal provides two types of display template tags:

For more information about display template JSP tags, see the Oracle Fusion Middleware JSP Tag Java API Reference for Oracle WebLogic Portal.

Before using a display template JSP tag, you must do the following:

11.1.1 Creating Display Templates

Display templates are JSP pages that you use in conjunction with display template JSP tags to display associated resources. These JSPs can incorporate any JSP functionality you require. You can use display templates to display repository content or other portal content, such as JSPs.

Tip:

As a best practice, it is helpful to store all display templates in the same directory in your web application.

You can create two types of display templates in your portal; each are registered differently and associated with the respective JSP tag.

  • Use content display templates to display repository content. These templates are registered for use with respective content types. You can use content display templates with the <dt:displaycmtemplate> tag.

  • Use display templates are used to display any other portal resource. They are used with the <dt:displaytemplate> tag.

Within the wlp-template-config.xml file, there are two "root" elements used to register display templates:

  • <content-repository> These templates are called content display templates.

  • <template-group> These templates are called display templates.

11.1.1.1 Using Views

You can create multiple display template JSPs for the same resource. Typically, you create multiple views for displaying the same content type with a content display template. For example, you can create a JSP that displays a thumbnail image and another JSP that displays a full image. You can also assign a default view to use for a resource. You then register each template as a view within the wlp-template-config.xml file. Each template you register must have at least one view. Example 11-3 gives an example of a content display template tag that uses a particular view.

11.1.1.2 Using Content Display Templates within Display Templates

It is possible to re-use templates within other templates by incorporating a template JSP tag within your JSP. By re-using display templates in this way, you can reduce the amount of code you need to maintain. For example, Content Presenter templates use display templates to display content within the Content Presenter portlet and re-use the same content display template whenever possible. The content display template contains the code needed to retrieve the content node. In this case, if you want to change what content is retrieved (such as including a new property), you need only update the content display template.

Tip:

A content display template is associated with a particular content type.

11.1.2 Creating a wlp-template-config.xml File

After creating a display template, you must create a configuration file that associates the template (JSP page) that you created with the respective resource. For example, if you have created a view to use with a content type, you must register that relationship using a wlp-template-config.xml file.

To create a new wlp-template-config.xml file using Oracle Enterprise Pack for Eclipse:

  1. In the Project Explorer, right-click your //<WebProject>/WEB-INF folder and select New > Other.

  2. In the Select a Wizard dialog, navigate to the XML > XML selection and click Next.

  3. In the Create XML File dialog, select Create XML file from an XML schema file and click Next.

  4. In the XML File Name dialog, type wlp-template-config.xml for the name of the new file and click Next. Be sure the file is located in the WEB-INF directory of your web project.

  5. In the Select XML Schema File dialog, mark Select from XML Catalog.

  6. Select http://www.bea.com/ns/p13n/90/wlp-template-config.xml and click Next.

  7. In the Select Root Element dialog, mark the Content Option check boxes for Create optional attributes and Create optional elements; see Figure 11-1.

    Figure 11-1 Selected Content Options in the Create XML File dialog

    Description of Figure 11-1 follows
    Description of "Figure 11-1 Selected Content Options in the Create XML File dialog"

  8. Click Finish.

  9. After creating your wlp-template-config.xml file, right-click it and select Open With > XML Editor (or the editor of your choice) to edit the file. Use the following examples to assist you when editing the file.

    • Example 11-1 provides an commented outline of the wlp-template-config.xml schema.

    • Example 11-2 provides an example of a wlp-template-config.xml file.

Example 11-1 wlp-template-config.xml

<wlp-template-config> 
   <!-- Describes the content repository's types and templates --> 
   <content-repository>
      <!-- Name of repository. (Required) --> 
      <name> </name>
      <!-- Optionally, used to define a namespace for this set of templates.-->
      <content-name-space>
         <!-- Description for developer use, not shown to end user (Optional) --> 
         <description> </description>
         <!-- If only the repository that matches this template is used to render
         content (Optional) -->
         <default-template-uri> </default-template-uri> 
         <!-- Describes the content type --> 
         <content-resource>
            <!-- Description not shown to end user (Optional) --> 
            <description> </description> 
            <!-- Name of content type.(Required) -->
            <name> </name>
            <!-- If only the content type matches, this template is used to
            render content. Contains the URI to the JSP location. (Optional) --> 
            <default-template-uri> </default-template-uri> 
            <!-- Describes the view (Optional) --> 
            <view> 
               <!-- Name of the view (Required) --> 
               <name> </name>
               <!-- Description not shown to end user (Optional) --> 
               <description> </description>
               <!-- If the view name that matches, this template is used to
               render content. Contains the URI to the JSP location.
               (Required) --> 
               <uri> </uri>
            </view> 
         </content-resource> 
      </content-name-space>
   </content-repository> 
<!-- Describes templates that are not linked to a content repository --!> 
   <template-group>
      <name></name>
      <!-- Optional. Allows you to namespace your templates for organizational
      purposes. If creating templates for the Content Presenter, use
      wlp-content-presenter-multiple or wlp-content-presenter-single.--!>
      <template-name-space>
         <name></name>
         <template> 
            <description> </description> 
            <!-- (Required)Name of template. This name displays as the Template
            Category name within the Content Presenter portlet. --!> 
            <name></name>
            <!-- Enter a default template URI. If your template definition
            contains no view elements, then this element is mandatory or the
            template will not work with the Content Presenter. --!>
            <default-template-uri> </default-template-uri>
            <!-- Optionally, specific a preview icon for this template --!>
            <default-template-preview-icon-uri>
            </default-template-preview-icon-uri>
            <view> 
               <name> </name> 
               <description> </description> 
               <uri> </uri> 
               <!--Optionally, specify a preview icon for this view --!>
               <preview-icon-url></preview-icon-url>
            </view> 
         </template> 
      </template-name-space>
   </template-group> 
</wlp-template-config> 

Example 11-2 provides an example of a valid wlp-template-config.xml file.

Example 11-2 Sample wlp-template-config.xml Document

<wlp-template-config> 
   <content-repository> 
      <name>MyRepo</name> 
      <default-template-uri>/MyDefault.jsp </default-template-uri> 
      <content-resource> 
         <name>thumbnail</name> 
         <view> 
            <name>small</name> 
            <uri>/smallview.jsp</uri> 
         </view> 
      </content-resource> 
      <content-resource>
         <name>Product</name>
         <default-template-uri>/MyProductDisplay.jsp</default-template-uri> 
         <view> 
            <name>small</name> 
            <uri>/product/smallview.jsp</uri> 
         </view> 
      </content-resource> 
      <content-resource> 
         <name>Camera </name>
         <default-template-uri>
            /MyCameraProductDisplay.jsp
         </default-template-uri> 
         <view> 
            <name>small</name> 
            <uri>/product/camera/smallview.jsp</uri> 
         </view> 
      </content-resource> 
   </content-repository> 
</wlp-template-config>

11.1.3 Using the <dt:displaycmtemplate> Within a JSP

The <dt:displaycmtemplate> is used to display content from your content repository. Content display templates are associated with content types and can have multiple views. See the Oracle Fusion Middleware JSP Tag Java API Reference for Oracle WebLogic Portal for more information about this tag and its attributes.

11.1.3.1 <dt:displaycmtemplate> Example

This example displays a content type of DigitalCamera which extends Camera which extends Product. See Section 11.1.3.2, "<dt:displaycmtemplate> Example Using Type Inheritance" for an example of how the tag takes advantage of type inheritance. It consists of three parts:

  • Example 11-3 – Provides an example JSP tag usage that uses a defined view

  • Example 11-4 – Provides an example usage that uses the default view

  • Example 11-5 – Provides the corresponding configuration file for these examples

    Tip:

    You can define a default view within your configuration file that is used for all content resources that do not have otherwise defined display templates. You do this by defining a content resource with a * as a value. For example, <name>*<name>. See Example 11-5 for an example. You can also use a * as <name> for the content-repository element.

Example 11-3 shows an example JSP tag usage that uses a defined view and how to specify the node with <cm:getNode>.

Example 11-3 <dt:displaycmtemplate> Tag Usage

<cm:getNode path="/WLP Repository/sampleFolder/sampleNode" id="aNode"/>
<dt:displaycmtemplate repositoryName="MyRepo" resourceName="DigitalCamera" view="small"/> 

Example 11-4 shows an example usage that uses the default view.

Example 11-4 <dt:displaycmtemplate> Tag Usage

<dt:displaycmtemplate repositoryName="MyRepo" resourceName="Camera" view="small"/>

Example 11-5 provides the corresponding configuration file.

Example 11-5 Corresponding wlp-template-config.xml

<wlp-template-config> 
   <content-repository> 
   <name>MyRepo</name> 
   <default-template-uri>/MyDefault.jsp </default-template-uri>
      <content-resource> 
         <!-- Using an * in the name element defines a default view for content
         resources that do not have registered templates.--!>
         <name>*</name>
         <view>
            <name>small</name>
            <uri>/smallview.jsp</uri>
         </view>
      </content-resource>
      <content-resource> 
         <name>Product</name> 
         <default-template-uri>/MyProductDisplay.jsp</default-template-uri> 
         <view> 
            <name>small</name> 
            <uri>/product/smallview.jsp</uri> 
         </view> 
      </content-resource> 
      <content-resource> 
         <name>Camera</name> 
         <default-template-uri>
            /MyCameraProductDisplay.jsp
         </default-template-uri>
         <view> 
            <name>small</name> 
            <uri>/product/camera/smallview.jsp</uri> 
         </view> 
      </content-resource> 
   </content-repository> 
</wlp-template-config> 
<!-- With this configuration the uri of "product/camera/smallview.jsp" will be
found. This is because the Digital Camera content type inherits from the Camera
content type and the camera <content-resource> has a small view. -->

11.1.3.2 <dt:displaycmtemplate> Example Using Type Inheritance

This example displays a content type of DigitalCamera which extends Camera which extends Product. Notice that the tag leverages type inheritance when searching for which view to use. For more information about type inheritance, see Section 6.1.1, "Using Content Type Inheritance."

Example 11-6 shows the syntax of the JSP tag.

Example 11-6 <dt:displaycmtemplate> Tag Usage

<dt:displaycmtemplate repositoryName="MyRepo" resourceName="DigitalCamera" view="full"/> 

Example 11-7 provides the corresponding configuration file.

Example 11-7 Corresponding wlp-template-config.xml

<wlp-display-template> 
   <content-repository> 
      <name>MyRepo</name> 
      <default-template-uri>/MyDefault.jsp </default-template-uri> 
      <content-resource> 
         <name>Product</name> 
         <default-template-uri>/MyProductDisplay.jsp</default-template-uri> 
         <view> 
            <name>small</name> 
            <uri>/product/smallview.jsp</uri> 
         </view>
         <view> 
            <name>full</name> 
            <uri>/product/fullview.jsp</uri> 
         </view> 
      </content-resource> 
      <content-resource> 
         <name>Camera</name> 
         <default-template-uri>
            /MyCameraProductDisplay.jsp
         </default-template-uri>
         <view> 
            <name>small</name> 
            <uri>/product/camera/smallview.jsp</uri> 
         </view>
      </content-resource>
   </content-repository> 
</wlp-display-template> 
<!-- With this configuration the uri of "product/fullview.jsp" will be found. This is the JSP tag takes advantage of type inheritance and knows that camera inherits from product. -->

11.1.4 Using the <dt:displaytemplate> Tag Within a JSP

Use the <dt:displaytemplate> tag to display any non-content management portal resources. For more information about this tag and its attribute, see the Oracle Fusion Middleware JSP Tag Java API Reference for Oracle WebLogic Portal.

11.2 Customizing the Content Presenter Configuration Wizard

The Content Presenter portlet provides a quick way to show customized content within your portal. With the Content Presenter portlet, any portal user with sufficient rights can change which content is displayed in the portlet. For more information about the Content Presenter portlet and configuration instructions, see "Configuring the Content Presenter Portlet" in the Oracle Fusion Middleware Portlet Development Guide for Oracle WebLogic Portal.

You can create custom display templates for the Content Presenter portlet. To use custom display templates within Content Presenter, you must register them specifically for Content Presenter within the wlp-template-config.xml file.

For example, you can create one template to control how the details of a single press release are displayed, and you can create another template to control how a list of multiple press releases are displayed. You allow portlet users to choose different views such as one that displays a summary of the press release, the press release's title only, or an internal view of the press release.

For general information about creating and configuring display templates, see Section 11.1, "Using Display Template JSP Tags."

Note:

When the user does not have authorization to view the content displayed in the Content Presenter portlet, the default behavior is to ignore the error and display an empty portlet. As the template designer, if you want to display a message instead, you must create the required logic in the template for handling the Authorization Exception.

11.2.1 Using Templates with Content Presenter

Content display templates cannot be used directly in Content Presenter.

However, you can use content display templates within your Content Presenter templates. By calling content display templates within a display template JSP, you can re-use code for different presentation styles.

Tip:

The Content Presenter portlet uses generic display templates within its implementation that are called by the <dt:displaytemplate> JSP tag. Content display templates are called with the <dt:displaycmtemplate> JSP tag; therefore they cannot be used directly by the Content Presenter portlet.

Using content display templates is optional and can make your template configuration more complicated. However, when you re-use content display templates within your Content Presenter templates, you can take advantage of content type inheritance, see Section 11.1.3.2, "<dt:displaycmtemplate> Example Using Type Inheritance."

11.2.2 Creating New Display Templates for the Content Presenter Wizard

This section contains an example of adding and configuring two new templates that can be used by the Content Presenter portlet.

First, you create a content display template that retrieves a press release content node and its title. Next you call that template, using the <dt:displaycmtemplate> tag, from two other display templates that each list the press release titles with different types of bullets. Finally, you register each template for use in the Content Presenter portlet by creating a wlp-template-config.xml file.

11.2.3 Creating a Content Display Template to Reuse

Optionally, you can use content display templates within your display templates to centralize code that retrieves content from your repository. In this example, you create a content display template that retrieves the title of a press release. You can later re-use this content display template in a display template registered for the Content Presenter. This way you avoid duplicating the code in each display template that displays the press release title.

Example 11-8 shows a content display template JSP file that will be re-used in a display template. Notice the use of the <cm:getProperty> that is used to retrieve content.

Example 11-8 A Sample Content Display Template Called pressReleaseTitleOnly.jsp

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.bea.com/servers/portal/tags/content" prefix="cm"%>
<cm:getProperty name="title"/>

Each template you create must be registered in the wlp-template-config.xml. When registering content display templates created for re-use in display templates designed for the Content Presenter portlet, you should include the <content-name-space> element and give it a wlp-content-presenter value, see Example 11-9.

For more information about how content display templates are registered, see Section 11.2.5, "Register Your Templates for Content Presenter Portlet."

Note:

If you want to overwrite an existing content display template that is being used, you can use the Content Display Template Wizard, see Section 11.3, "Using the Content Display Template Wizard."

Example 11-9 Example wlp-template-config.xml File for a Content Display Template to be Re-used in a Content Presenter Display Template

...
<content-repository>
   <name>WLP Repository</name>
   <content-name-space>
      <name>wlp-content-presenter-multiple</name>
      <content-resource>
         <name>pressRelease</name>
         <default-template-uri>
            /templates/cm/pressReleaseDefault.jsp
         </default-template-uri>
         <view>
            <name>Press Release Title Only</name>
            <description>
               This retrieves on the title property of a pressRelease.
            </description>
            <uri>/templates/cm/pressReleaseTitleOnly.jsp</uri>
         </view>
      </content-resource>
   <content-name-space>
</content-repository>
...

11.2.4 Creating Display Templates for the Content Presenter Portlet

You can design your display templates with all the flexibility allowed by JSPs. The example in this section provides two different display templates (JSPs) that each prepend different bullets in front of a list of press release titles.

Use the <dt:displaycmtemplate> tag in these JSPs to call the pressReleaseTitleOnly content display template, as described in Section 11.2.3, "Creating a Content Display Template to Reuse." This helps minimize template code, enforces common presentation patterns, and allow you to take advantage of content type inheritance. For more information, see Section 11.1.3.2, "<dt:displaycmtemplate> Example Using Type Inheritance."

Example 11-10 provides an example of template that uses a text bullet to prepend the list of press release titles.

Example 11-10 A Template View Called pressReleaseListBulletText.jsp (using a text bullet)

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.bea.com/servers/portal/tags/dt" prefix="dt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/wlpapps/contentui/templates"
    prefix="templateTags"%>
<templateTags:getTemplateNodes var="nodes"/>
<c:forEach items="${nodes}" var="node">
    &bull;
    <dt:displaycmtemplate
    resourceName="${node.objectClass.name}"
    ϖιεω=∀Πρεσσ Ρελεασε Τιτλε Ονλψ∀
    ** This node is passed to the content display template.**
    node="${node}"/>
    <br/>
</c:forEach>

Example 11-11 provides an example of a template that uses a .gif image.

Example 11-11 A Template View Called pressReleaseListBulletImage.jsp (using a *.gif)

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.bea.com/servers/portal/tags/dt" prefix="dt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/wlpapps/contentui/templates "prefix="templateTags"%>
<templateTags:getTemplateNodes var="nodes"/>
<c:forEach items="${nodes}" var="node">
   <img src="bullet.gif"/>
   <dt:displaycmtemplate
      resourceName="${node.objectClass.name}"
      view="Press Release Title Only"
      node="${node}"/>
   <br/>
</c:forEach>

11.2.5 Register Your Templates for Content Presenter Portlet

You use a wlp-template-config.xml file to register templates for the Content Presenter Portlet.

When you register templates for the Content Presenter portlet, be sure to include the required elements to ensure the templates are accessible. The values for some of these elements are also shown to users when they use the Content Presenter Configuration Wizard wizard. For example, you must use appropriate namespaces for both the content display templates and display templates to ensure that the templates can be used in Content Presenter.

Example 11-12 provides a blank example of the configuration elements that are re-used in the Content Presenter Configuration Wizard. See Table 11-0 for detailed information about these required elements.

Example 11-12 Blank Example of wlp-template-config.xml including Elements used in Content Presenter Wizard

<template-group>
   <name>My Custom Template Category</name>
   <template-name-space>
      <name>wlp-content-presenter-multiple</name>
      <view>
...
   </template-name-space>
</template-group>
OR
<template-group> 
   <name>My Custom Template Category</name>
   <template-name-space>
      <name>wlp-content-presenter-single</name>
      <view>
...
   </template-name-space>
</template-group>

Table 11-0 lists the configuration elements specific to configuring a display template for use in the Content Presenter portlet. Example 11-13 provides an example of these elements as they should appear in the wlp-template-config.xml file when configuring the new templates used in this example.

Note:

For a complete example of the wlp-template-config.xml, see Example 11-1.

Table 11-1 Configuration Elements Specific to Content Presenter Templates

wlp-template-config.xml Element What it does:

<template-group>

Defines a group of templates for the Content Presenter portlet.

Template groups are represented in the Content Presenter Configuration Wizard portlet as "Template Categories".

<template-name-space> (child element of <template-group>)

Defines the namespace of a template or category (as seen in the Content Presenter portlet). The namespace is required and allows you to differentiate whether the templates are available to present multiple or single content items.

In the Content Presenter Configuration Wizard, the value of this namespace determines if the template is available for multiple or single content items.

<name> (child element of <template-name-space>)

The value of this element determines if the template or view displays as a selection for a multiple or single item template within the Content Presenter Configuration Wizard.

This element must have one of the following values:

wlp-content-presenter-multiple

Any templates within the wlp-content-presenter-multiple namespace appear when the user selects the option to show multiple content items in the wizard. Therefore, all templates placed under this namespace should be written to handle multiple content items.

wlp-content-presenter-single

The wlp-content-presenter-single namespace is designed for templates that handle a single content item.

<default-template-uri>

Defines a default template JSP to be used for this template category. If you use a template view within this category, you can omit this element.

If you do not have any template views for this namespace, the <default-template-uri> element is required.


Tip:

Defining multiple views within a template category can help organize your content and make it easier to use the Content Presenter Configuration Wizard. For example, you create a template category called Press Releases that has a <default-template-uri>. You might need several ways to view Press Releases, such as a Press Release Summary, Press Release Title Only, Press Release Public View, and Press Release Internal View. In this case, creating multiple template views under your Press Releases template category is a good solution. For more information about views, see Section 11.1.1.1, "Using Views."

Example 11-13 shows a sample wlp-template-config.xml file that references the content display template created earlier (see Example 11-8) and both display templates that are used directly by the Content Presenter portlet (see Example 11-10 and Example 11-11).

Note:

This example also includes a content display template that cannot be used within the Content Presenter. For more information about using display templates, see Section 11.1, "Using Display Template JSP Tags."

Example 11-13 A wlp-template-config.xml File That Includes the New Templates

<?xml version="1.0" encoding="UTF-8"?>
<wlp-template-config xmlns="http://www.bea.com/ns/p13n/90/wlp-template-config">
<content-repository>
   <name>WLP Repository</name>
   <!--The following bold section is an example of a content display
   template that not been namespaced for Content Presenter use. It can 
   still be used within a Content Presenter template.-->
   <content-resource> 
      <name>Product</name> 
      <default-template-uri>
         /MyProductDisplay.jsp
      </default-template-uri> 
      <view> 
         <name>small</name>
         <uri>/product/smallview.jsp</uri> 
      </view> 
      <view> 
         <name>full</name> 
         <uri>/product/fullview.jsp</uri> 
      </view> 
   </content-resource>
<!-- The following bold section is an example of the best practice of using
a namespace for a content display template that is re-used within a template
for the Content Presenter portlet. -->
   <!-- This name element creates a namespace for this template -->
   <content-name-space>
      <name>wlp-content-presenter-multiple</name>
      <content-resource>
         <name>pressRelease</name>
         <default-template-uri>
            /templates/cm/pressReleaseDefault.jsp
         </default-template-uri>
         <view>
            <name>Press Release Title Only</name>
            <description>
               This retrieves on the title property of a pressRelease.
            </description>
            <uri>/templates/cm/pressReleaseTitleOnly.jsp</uri>
         </view>
      </content-resource>
   </content-name-space>
</content-repository>
<!--The following bold section is an example of a display template that is
used directly by the Content Presenter template. It includes a template
group, a template namespace, and also uses the view element to list different
templates associated with this category. Optionally, it includes a preview
icon for both the default template and each view to aid users in selecting
the correct template in the wizard. -->
   <template-group>
      <name>Custom Template Category</name>
      <template-name-space>
         <name>wlp-content-presenter-multiple</name>
         <template>
            <description>
               This is the default template for listing Press Releases.
            </description>
            <name>Press Release List Template</name>
            <default-template-uri>
               /templates/pressReleaseList.jsp
            </default-template-uri>
            <default-template-preview-icon-uri>
               /templates/images/pressReleaseList.gif
            </default-template-preview-icon-uri>
            <view>
               <name>Press Release Bulleted List - Text</name>
               <description>
                  This lists Press Releases with text bullets.
               </description>
               <uri>/templates/pressReleaseListBulletText.jsp</uri>
               <preview-icon-uri>
                  /templates/images/pressReleaseListBulletText.gif
               </preview-icon-uri>
            </view>
            <view>
               <name>Press Release Bulleted List - Image</name>
               <description>
                  This lists Press Releases with imagebullets.
               </description>
               <uri>/templates/pressReleaseListBulletImage.jsp</uri>
               <preview-icon-uri>
                  /templates/images/pressReleaseListBulletImage.gif
               </preview-icon-uri>
            </view>
         </template>
      </template-name-space>
   </template-group> 
</wlp-template-config> 

11.3 Using the Content Display Template Wizard

In Oracle Enterprise Pack for Eclipse, you can use the Content Display Template Wizard to create new content display templates. The Content Display Template Wizard generates the appropriate JSP and generates a file that registers the template according to the repository and content type you choose.

After creating the content display template, you can customize it (using the JSP editor in Oracle Enterprise Pack for Eclipse, for example). As long you do not change the name of the display template, it remains registered.

The Content Display Template Wizard in Oracle Enterprise Pack for Eclipse uses the <dt:displaycmtemplate> tag to create content display templates.

Tip:

Templates that you create with the Content Display Template Wizard do not automatically appear in the Content Presenter Configuration Wizard, because the configuration wizard only shows templates that were created with the <dt:displaytemplate> tag. If you created a template with the Content Display Template Wizard, you can make the template appear in the Content Presenter Configuration Wizard by calling the template you created in Oracle Enterprise Pack for Eclipse (<dt:displaycmtemplate>) from a regular display template (<dt:displaytemplate>) that you create in the Content Presenter Configuration Wizard.

11.3.1 Updating Content Presenter Display Templates

You can update content display templates that are referenced in the Content Presenter display templates using the Content Display Template Wizard. If you select a previously registered namespace and view, the content display template you create can be called by existing Content Presenter display templates. For more information about configuring Content Presenter display templates, see Section 11.2.2, "Creating New Display Templates for the Content Presenter Wizard."

If you want to change or update the content properties that are retrieved for a Content Presenter display template, you can overwrite an existing view with the Content Display Template Wizard. For example, the wlp-default-list view (WLP Default List) lists the primary property of a content item. If you want to update the wlp-default-list view to list additional properties, you can use the Content Display Template Wizard to create a new JSP (that uses the same view name of wlp-default-list) that includes only the content type properties you select.

11.3.2 Creating a Content Display Template

To create a content display template in Oracle Enterprise Pack for Eclipse:

  1. Switch the portal perspective if you are not already using it. Select Window > Open Perspective > Other > Portal.

  2. Choose File > New > Other.

  3. In the Select a Wizard window, expand the WebLogic Portal directory, select Content Display Template, and click Next.

  4. In the Select Project window, highlight your portal web project and click Next.

  5. In the Content Properties window, choose the content properties you want to display with your template.

    Note:

    When you use the wizard to create a content display template, you can either access the content types and properties on your server or enter them manually if you do not have access to the server.

    If you are running a server:

    • Select a content type from the Content Types field. The drop-down menu lists all available content types in your repository.

    • Choose which content properties to display in the template by selecting the corresponding check boxes. You can also click Select All.

      Note:

      The Content Display Template Wizard does not support nested or linked content properties. If you want to use these properties in your template, you need to manually edit the content display template JSP.
    • Click Next.

    If you are not running a server:

    • Click Add Property to add each content type property to the wizard that you want to display. Enter the name and data type of the property and click OK.

    • You can also select the Display all node properties check box to retrieve all content type properties at run time. You can then manually edit the display template to update or change the way the properties are retrieved (remove properties, change sort order and so on).

    • When finished adding content type properties, click Next to continue to the Template Information page.

  6. In the Template Information page, use the drop-down menu to select a Repository Name, Namespace, and Content Type.

    • If you are updating a content display template used by the Content Presenter Configuration Wizard, your namespace must be either wlp-content-presenter-multiple or wlp-content-presenter-single. See Section 11.2.5, "Register Your Templates for Content Presenter Portlet" and see the Tip at the end of this section.

    • You can also use an asterisk (*) for the content repository or content type, and the template matches any content repository or content type.

  7. In the View Information window, enter the template view name and information.

    1. In the View Name field, select an existing view (populated from the current display template configurations) to overwrite the existing configuration. You can also create a new view by typing a new name.

      Table 11-2 lists the content display template views available in Oracle Enterprise Pack for Eclipse. These template views are not automatically visible in the Content Presenter Configuration Wizard, unless you perform additional steps (see the TIP at the end of this section).

      Table 11-2 Content Presenter Content Display Template Views

      View What it does:

      WLP Default Syndication View

      Lists all properties of the content item in a syndication feed. For more information, see Section 12.2.1, "Creating the Syndicated Feed JSPs."

      WLP Default Details

      Lists all properties of the content item.

      WLP Default Single Property

      Lists a single node and a single property.

      WLP Default List

      Lists the primary property of a content item.

      WLP Content Presenter Wizard Item Details

      Lists all properties of the content item within the wizard


      Note:

      You must have added the Content Presenter facet to your web project in order to access the Content Presenter template views. For more information about the Content Presenter portlet, see the Oracle Fusion Middleware Portlet Development Guide for Oracle WebLogic Portal.
    2. You can choose to enter a description of your view in the View Description field.

    3. You can also choose to associate an icon with this view. When you associate an icon with a view, the icon is used to assists users in choosing the correct template view in the Content Presenter Configuration Wizard.

    4. Click Next.

  1. In the View JSP page, save the new template to a location within your web project.

    1. Enter the JSP in the File Name field, including the .jsp extension.

    2. If the file already exists and the Overwrite existing resource? check box is not selected, the file is not modified.

    3. Select the Open the JSP file when wizard is finished? check box to immediately view the JSP in the JSP editor.

    4. Select the Use JSTL tags in template? check box if your application uses the JavaServer Pages Standard Tag Library (JSTL).

  2. Click Finish to view the JSP file in the JSP Editor in Oracle Enterprise Pack for Eclipse.

The template and view configuration information is stored in the wlp-template-config.xml file and the new JSP is created.

Tip:

Templates that you create with the Content Display Template Wizard in Oracle Enterprise Pack for Eclipse do not automatically appear in the Content Presenter Configuration Wizard, because the configuration wizard only shows templates that were created with the <dt:displaytemplate> tag. If you created a template with Oracle Enterprise Pack for Eclipse's Content Display Template Wizard, you can make the template appear in the Content Presenter Configuration Wizard by calling the template you created in Oracle Enterprise Pack for Eclipse (<dt:displaycmtemplate>) from a regular display template (<dt:displaytemplate>) that you create in the Content Presenter Configuration Wizard.