Creating Placeholders

A placeholder is a predefined location in a JSP that displays a single piece of Web content retrieved from the BEA Virtual Content Repository. A placeholder uses queries to retrieve and display content.

By default, placeholders support the following MIME types: HTML, XML, plain text, images, and Shockwave files. To display additional MIME types in placeholders, see Supporting Additional MIME Types.

When a user views a portal desktop or portlet containing a placeholder, the placeholder's rules and back-end logic run a query, retrieve zero or more pieces of content matching the query, and display one of the returned items. If no content is retrieved, none is displayed.

The queries for a placeholder come from two different places:

Because a placeholder can contain multiple queries, the placeholder serves as a content bucket that can display a different piece of content each time a user accesses the JSP containing the placeholder. The following procedure includes a step that lets you set a query's priority to increase or decrease the chances that the query is run instead of other queries present in the placeholder.

Placeholders are scoped to the enterprise application, so you can include Placeholders in any JSPs within the enterprise application.

For more information on placeholders, see the Interaction Management Guide on BEA's e-docs Web site.

To create a placeholder

  1. If your server is not running, start it by choosing Tools-->WebLogic Server-->Start WebLogic Server.
  2. In the Application window, right-click the data\placeholders folder and choose New-->Placeholder.
  3. In the New File window, enter a name for the placeholder in the File name field. Make sure you keep the file extension.
  4. Click Create. The placeholder designer appears.
  5. In the Palette window, drag the New Query icon into the placeholder designer to define a default query.

    Every query you add to the placeholder in this way is a default query (non-campaign). Campaigns can also put queries in this placeholder, but campaign queries are not defined in the placeholders themselves. They are defined in the campaigns.
  6. In the Property designer window, set values for the following:
  7. To define the query, click the empty content search link in the New Query item you added. You can define the query in advanced mode using WebLogic Portal's expression syntax (on the Advanced tab) or in graphical mode (on the Query tab).

    Advanced mode - In the Content Search window, click the Advanced tab and build a query using the instructions in Building Content Queries with Expressions.

    Graphical mode - Use the following steps to build a content query by selecting content properties, comparators, and values to retrieve content items.
    1. In the Content Search window, click the Query tab.
    2. Select a content type, select a Property within the content type, and click Add.

      Note: The properties you select are content properties (types) rather than property set properties such as user profile or session properties.
    3. In the Content Search Values window that appears, use one of the following tabs:
      • Values - To define the query based on a comparison to a value you enter. For example, the query could be set to retrieve content with an "investorRiskLevel" property that is marked as "high."
      • Properties - To define the content query based on the property value that is dynamically fed in from another type of property, such as a user profile property. For example, instead of creating a query based on static content properties, you can create a query that reads in the value of the current user's "investorRiskLevel" to populate the query. The query would be different for each user.
    4. Click Add. The query descriptor is added in the Content Search window.
    5. You can add more value phrases to the query, then set the appropriate option in the For multiple descriptors area at the bottom of the window.
  8. Click OK in the Content Search window.
  9. Create additional queries as needed.
  10. You can preview the content that will be retrieved by the query in the Content Preview window below the designer. If you defined the query to use values from a user profile property, the retrieved content will be different for each user, so you must enter the username of an existing user in the Preview User field, such as weblogic, to see which content will be retrieved for that user.

    Note: The Content Preview window shows content that the query will retrieve. However, since a placeholder can show only one piece of content at a time, the single piece of content that is displayed varies depending on which query is run (determined by the priority you set for a query and the settings for campaign queries) and the adWeight property setting on content.

    You must add the adWeight property to a content type as a single-value Integer. Content with a higher adWeight number has a higher likelihood of being selected for display in a placeholder.
  11. Save the placeholder file.
  12. To use the placeholder, add the <ph:placehoder> tag in the relevant JSPs.

Note: As an alternative to Placeholders, you can use the <ad:adTarget> JSP tag to hard-code a content query within the tag.

To modify a placeholder

To modify a placeholder, open its file by double-clicking it in the WebLogic Workshop Application window. Select and modify the appropriate query.

To delete a query or placeholder

To delete a query in a placeholder, open the placeholder file, select the query in the Document Structure window, and press the Delete key.

To delete a placeholder, select it in the Application window, press the Delete key, and click OK in the confirmation dialog box. Also delete any <ph:placeholder> tags in your JSPs for the deleted Placeholder.

Related Topics

<ph:placeholder> Tag

Creating Campaigns