Oracle® Fusion Middleware Interaction Management Guide for Oracle WebLogic Portal 10g Release 3 (10.3.4) Part Number E14238-03 |
|
|
View PDF |
Content Selectors use rules to target specific groups of people with content items from the WLP Virtual Content Repository. Content Selectors return and display content. For example, if a user logs in and is identified in the User Profile as a book fan, a Content Selector can display a list of recommended books.
Developers can use Oracle Enterprise Pack for Eclipse to create and update Content Selectors and place them in a JSP. Portal administrators use the Administration Console to make changes to the Content Selectors that display content in your portal. You can retrieve both published and versioned content in a content selector. For more information about publishing content, see Adding Content to a WLP Repository in the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal.
Users do not have to be authenticated (logged in) to be targeted by Content Selectors. For example, the presence of specific HTTP request or session properties, or specific date and time conditions can trigger content to be displayed. You can, for example, display targeted holiday content to users who visit your portal in the month of December and view your portal with a specific type of web browser.
However, authenticated users (as well as anonymous tracked users) have profile information associated with them that you can use to target them with personalized content. A book fan is an example of this type of User Profile data.
Note:
The steps in this chapter refer to the data\src folder in the Package Explorer View. Your data and src directories might be named differently.This chapter includes the following sections:
Content Selectors retrieve content properties, which are usually text or numeric values. For example, you want your Content Selectors to retrieve information about books. Book content can be assigned many properties, such as title, author, publication date, ISBN, and a URL to the publisher's web site. You may want your Content Selector to display a bulleted list of titles and link each title to the publisher's web site. This list and link is accomplished through using just the text values of the content properties.
However, your book content could also have a binary property that stores an image of the book's cover. The Content Selector can also display that binary property—the actual image—using the ShowProperty
servlet, as described in Section 7.2.1, "Creating a Placeholder File." The type of binary content that Content Selectors can display is dependent on the MIME types you have configured. By default, WebLogic Portal provides MIME support for displaying images and other types of files. See Section 7.1.1, "Displaying Additional MIME Types in a Placeholder" for more information on other types.
Content Selectors are scoped to the enterprise application, so you can include a Content Selector in any JSP within the enterprise application.
A Content Selector consists of the following two parts:
Content Selector file – The Content Selector file that you create in Oracle Enterprise Pack for Eclipse contains the following parts:
Personalization rules – The conditions that define when the Content Selector runs its query and displays the content. The following conditions can be used to trigger a Content Selector:
The visitor is a member of a predefined User Segment
The visitor has specific characteristics (User Profile properties)
Specific HTTP session or request properties exist
Date and time conditions
A content query that retrieves a specific set of content properties.
The <pz:contentSelector> JSP tag – This companion tag performs the processing and is also created in Oracle Enterprise Pack for Eclipse. Content returned from Content Selectors is usually displayed in portlets. When a user views a portlet or a portal desktop that contains a Content Selector, the Content Selector's rules and logic look for a match of properties, such as User Profile information. If the properties match the Content Selector rules, the Content Selector runs a query and retrieves and displays all content matching the query.
Tip:
During development, the rules files reload when they change (just like JSPs), so you can quickly develop with Content Selectors. However, when the server is in production mode, Content Selectors are loaded into the database (from the file-based definitions in the application) where they can be modified in the WebLogic Portal Administration Console without redeploying the application or restarting the server.Use the following guidelines when you create Content Selectors.
Create a Content Selector for each audience you want to target. If you have five audiences you want to target with content, create five Content Selectors, then add five <pz:contentSelector>
tags to your JSP, each of which references its own Content Selector file.
When a Content Selector is triggered and runs its query, the results (node objects) are returned to the <pz:contentSelector>
JSP tag and stored in the tag's id attribute. At this point, you need other tags or code to process and display the content. The tags described in Table 6-6 are useful tags for displaying retrieved content.
The Search.setSortCriteria
method only works for searching published content. This method is not supported for searching versioned content.
To display binary content retrieved by Content Selectors, use the ShowProperty
servlet. The following code example shows how to use the ShowProperty
servlet:
<pz:contentSelector rule="classic" id="nodes"/> <utility:notNull item="<%=nodes%>"> <ul> <utility:forEachInArray array="<%=nodes%>" id="node" type="com.bea.content.Node"> <img src="<%=request.getContextPath() + "/ShowProperty" + node.getPath()%>"> </utility:forEachInArray> </ul> </utility:notNull>
The <img>
HTML tag's source path is constructed to use the path to the content item in the Virtual Content Repository. The path includes the ShowProperty
servlet to render the binary file. In the node.getPath()
method, node
is a specific content item stored by the <utility:forEachInArray>
tag's id attribute. If the <utility:forEachInArray>
id attribute value was foo, the method would look similar to the following: foo.getPath()
.
This section contains the following topics:
Perform the following steps to create a Content Selector file:
Start the WebLogic server by choosing Run As > Run on Server in Oracle Enterprise Pack for Eclipse. For instructions on configuring the WebLogic Server, see the Oracle Fusion Middleware Portal Development Guide for Oracle WebLogic Portal.
In the Portal Perspective, right-click the <data>\src\contentselectors\GlobalContentSelectors folder in the Package Explorer View and choose New > Content Selector.
Enter a name for the Content Selector in the File name field, using the .sel
file extension, as shown in Figure 6-1.
Click Finish. The Content Selector Editor appears.
Select the Properties tab to change the description for the Content Selector.
Select the Design Palette tab to see the Available Conditions under which the Content Selector will run. As you select conditions, corresponding links appear in the top of the Editor window.
In the Content Selector Editor window, click the corresponding links to create the conditions you selected, and enter the appropriate information.
In the Content Selector Editor window, click the query's empty content search link to define the query. This requires a connection to WLP's Virtual Content Repository, which is set up in the WebLogic Portal Administration Console.
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, select the Advanced tab and build a query using the instructions in Section 6.2.1.1, "Building a Content Query with Expressions." The Advanced tab provides code coloring to highlight context errors in your queries. You can reuse existing queries by pasting them into the Advanced tab.
Graphical mode – Use the following steps in the Query tab to build a content query by selecting content properties, comparators, and values to retrieve content items.
In the Content Search window, select the Query tab.
Select a property set and a property within the content type, and click Add. One of the default property sets is Standard Versioned, which retrieves versioned content. Use the Standard Versioned properties to narrow your content search. For example, you can retrieve only the latest version of a graphic by selecting the cm_latestVersion property.
Note:
The properties you select are system content properties, rather than property set properties like user profile or session properties.In the Content Search Values dialog that appears, use one of the following tabs:
Values tab – 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
. You could also retrieve binary content with a name of IRACampaign. See Figure 6-2 for an example and Table 6-6 for more details.
Figure 6-2 A Content Query that Retrieves a Binary File Called IRACampaign
Properties tab – 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.
Click Add. The query descriptor is added in the Content Search window.
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.
Click OK in the Content Search window to add the query to the search.
You can preview the content that will be retrieved by the query by clicking the Content Preview tab. 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 user name of an existing user in the Preview User field to see which content will be retrieved for that user. By default, you preview published content. If you want to preview versioned content, click Controls whether this will preview versioned or published content, as shown below. (Click the Menu icon next to this icon to toggle between versioned content and published content.)
For more information about publishing content, see Adding Content to a WLP Repository in the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal.
Save the Content Selector file by choosing File > Save.
To use the Content Selector, add the <pz:contentSelector>
tag to the relevant JSPs. See Section 6.2.2, "Using a JSP Tag to Display a Content Selector File" for more information on using the <pz:contentSelector>
tag to display text content (including text binaries, such as HTML files) and non-text binaries (graphics).
Tip:
Content Selectors can display binary content, such as images. See the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal for instructions.Figure 6-3 shows a Content Selector file called classic.sel
. The condition that triggers the Content Selector is a user with a property set of SalesRegion with a value of Americas
. The content that is retrieved is any content with a binary file name that contains IRACampaign
.
Figure 6-3 Content Selector File in Oracle Enterprise Pack for Eclipse
Tip:
When library services (for example, versioning and workflow status) are enabled for a WLP Repository, system properties are always available to queries unless the content item has a retired status. You can search for both published and versioned content. If you want to retrieve content based on its content type, you must use the cm_objectClass system property in your content query. If your queries use only system properties, the query retrieves all content items with matching system properties that are not retired.Users do not have to be authenticated to be targeted by Content Selectors.
You can use the WebLogic Portal Expression language in WebLogic Portal Administration Console to build content queries. You can build queries with the Advanced Query window from content-related JSP tags and when you are creating queries for Placeholders, Campaigns, and Content Selectors.
The query compares a content property to a value that you enter. A query contains the following three parts: <property><comparator><value>
.
If the comparison is true
, all matching content items are retrieved.
For example, employee_type == 'manager'
. This query retrieves any content item from the WLP Virtual Content Repository with a property called employee_type
that contains the exact (==) String manager.
Queries are often made up of multiple clauses using and (&&) and or (||) logic. For example:
Query | Description |
---|---|
(genre == 'rock' || genre == 'alternative') &&
|
This query retrieves any content item with a genre property that has an exact value of rock or (||) alternative and (&&) with a platinum_records property value greater than 2 . The parentheses separates one section of the query from the next, controlling the order of evaluation. |
(genre=='rock' || genre=='country') && artist=='dead' |
This query retrieves any content item with a genre property that has an exact value of rock or country and an artist property value of dead . |
This section contains the following topics:
Use the following rules when you build a query:
Queries are case sensitive.
Queries can be simple, one-clause queries, or they can be more complex, multi-clause queries. In complex queries, parentheses control the order of evaluation for multiple query clauses, and clauses are evaluated using and (&&
) and or (||
) logic.
In a Placeholder, only one content item can be displayed at a time. If you are using a Placeholder to run queries from a Campaign (as well as its own default queries), you can run several queries, but only one query at a time. The query is determined by the Placeholder's weighting system. After the query runs, the query can return multiple content items, but the Placeholder displays only one of the retrieved content items.
Tip:
With your development server running, create a test Placeholder or Content Selector in Oracle Enterprise Pack for Eclipse and construct queries for it using the Advanced tab in the Content Search window. The retrieved content is displayed in the Content Preview tab. If you utilize the userProperty() format to retrieve values for your query, you must enter a user name in the Preview User field of the Content Preview tab to retrieve the values for that user and display the retrieved content items.The following two types of properties exist for content:
User-defined content properties.
System content properties. See Table 6-6 for a list of system content properties.
You can use both properties in a query.
User-defined content properties are stored in sets called types, which are defined in the WebLogic Portal Administration Console. For example, you can create a type called Book and add properties, such as title, author, pub_date, and isbn.
System content properties are automatically associated with all content items and are automatically assigned values for a content item when the content item is added to the content repository. System properties can be used to retrieve published content or versioned content. These properties, which are also listed in the com.bea.content.expression.Search
class, include the items listed in Table 6-1.
Table 6-1 System Content Properties
Property | API | Type of Content | Description |
---|---|---|---|
cm_uid |
|
Published and Versioned |
The unique ID for a content item. You can view a content item's unique ID by selecting the content item in the Administration Console and viewing its description. |
cm_createdDate |
|
Published |
The date on which a content item was created. You can view Creation Date information for content items by selecting their content folder in the Administration Console and selecting the Summary tab. |
cm_createdBy |
|
Published |
The user who created the content item. You can view Created By information for content items by selecting the content folder in the Administration Console and selecting the Summary tab. |
cm_modifiedDate |
|
Published and Versioned |
The date the content item was last modified. You can view Modified Date information for content items by selecting their content folder in the Administration Console and selecting the Summary tab. |
cm_modifiedBy |
Node.modifiedBy |
Published and Versioned |
The user who last edited the content. |
cm_nodeName |
|
Published and Versioned |
The name of the content item, as shown in the Administration Console. |
cm_path |
|
Published |
The Virtual Content Repository path to the content item. For example,
|
cm_isHierarchy |
|
Published |
Identifies a content folder rather than a content item. Content folders can contain content items and child content folders. When using this property in queries, compare it using a Boolean value of |
cm_isContent |
|
Published |
Identifies a content item rather than a content folder. Content items contain properties from the type with which they are associated. When using this property in queries, compare it using a Boolean value of |
cm_objectClass |
|
Published |
The content type associated with a content item. You can view Type information for content items by selecting the Types tab in the Administration Console and selecting the Summary tab. |
cm_objectClassInstance |
The instance of an object class |
Published |
Finds all instances of a given object class and all of its children. |
cm_value |
The value |
Published and Versioned |
A metadata search for any property with a given value. This property is similar to a wildcard search. |
cm_contentType |
|
Published and Versioned |
The MIME type for content item binary properties. For example, |
cm_binarySize |
(For Node Properties) |
Published and Versioned |
The size of the binary value of content items. You can view the size of a content item's binary value by selecting the content item in the Administration Console, selecting the Properties tab, and clicking Download File. Click Save and right-click the displayed binary file to view the file properties. When you use this property in a query, specify binary size in bytes. |
cm_binaryName |
(For Node Properties) |
Published and Versioned |
The file name of the binary value of a content item. You can view the name of a content item's binary value by selecting the content item in the Administration Console and viewing the Name value in the Summary tab. |
cm_assignedToUser |
|
Versioned |
The user to which the node is assigned. For example, |
cm_checkedOut |
|
Versioned |
If the node is checked out. For example, |
cm_latestVersion |
|
Versioned |
The latest version of the content. For example, |
cm_role |
|
Versioned |
The role to which the node is assigned. For example, |
cm_version |
|
Versioned |
The version number of the content. This value is a string. For example, |
cm_versionComment |
|
Versioned |
Text describing the changes to the version. For example, |
When you construct a query, you can specify property names by themselves without quotes. For example: title <comparator> <value>
. However, if a property name contains spaces, double quotes, or dashes, you must enclose the property name within a toProperty()
format. For example: toProperty('Favorite Author') <comparator> <value>
.
The query looks for the property name in all content types and returns any content item with that property value (if the content item meets the conditions of the query). However, you can also isolate a property within a specific type. For example, if you have a books type and an articles type that both contain a title property, you can retrieve content items with a specific title from within only the book type using the cm_objectClass property.
For example: title likeignorecase '*Adventure' && cm_objectClass = 'books'
Comparators provide the logic that compares a query's property to the value you enter. If a content item meets the conditions of the query, the content item is returned. Table 6-2 contains a list of the comparators you can use in your queries.
Table 6-2 Available Comparators
Comparator | Description (Property Formats on Which the Comparator Can Act) |
---|---|
|
Checks to see if a single-value property (including a single value containing a list) is exactly equal to the case-sensitive value you enter (Boolean, date and time, numeric, and string values). For example, |
!= |
Checks to see if a single-value property (including a single value containing a list) is not equal to the case-sensitive value you enter (Boolean, date and time, numeric, and string values). For example, |
> |
Checks to see if a single-value property is greater than the value you specify (date or time and numeric values). For example, |
< |
Checks to see if a single-value property is less than the value you specify (date or time and numeric values). For example, |
>= |
Checks to see if a single-value property is greater than or equal to the value you specify (date or time and numeric values). For example, |
<= |
Checks to see if a single-value property is less than or equal to the value you specify (date or time and numeric values). For example, |
like |
Checks to see if a single-value property is like the case-sensitive value you enter. You can use wildcard characters * (one or more characters) or ? (single character). For example, Note: If you do not put the asterisk (*) at the end, the content item is not retrieved, because more text follows the name Penman in the property value. |
likeignorecase |
Checks to see if a single-value property is like the value you enter. You can use the wildcard characters * and ?. Character case is ignored. For example, |
contains |
Checks to see if a multi-value property contains exactly the single value you specify (date or time, numeric, and string values). In some implementations, this comparator may also work against single-value properties. For example, |
containsall |
Checks to see if a multi-value property contains all of the exact values you specify (date or time, numeric, and string values). For example, |
containsany |
Checks to see if a multi-value property contains any of the exact values you specify (date or time, numeric, and string values). For example, |
in |
Checks to see if a single-value property contains any of the values you enter. If the value you enter is not a list of possible values (is a single value), |
Values represent the content you want the query to return. By supplying values to a query, you are telling the query which content to retrieve or ignore based on the values stored on the content items.
For example, if you have a content type called book with a property called title, all content items you associate with the book type have a title field. Each title value is unique, so in a query, you can enter the unique value you want, resulting in the query retrieving a specific content item (or ignoring the content item, depending on the comparator you use).
You can enter values in two ways:
Hard code values in the queries – Use hard-coded values so that you get predictability with your queries. Hard-coded values let you pinpoint the specific content you want to retrieve.
Get values from User Profiles and other types of property sets (Session and Request) – When you populate values from User Profile, session, or request property sets, the value in each specified User Profile, session, or request property is inserted programmatically into the query, letting you create personalized queries based on the current user's preferences or the current session or request.
For example, in a query where a content property is author, you can get the value of the user's FavoriteAuthor profile property to supply the value for the query, letting the query retrieve content associated with the user's favorite author.
Use the following guidelines to build values in queries:
Enclose string literal values in single quotes. For example: 'pending'
.
To supply a single or double quote, use a backslash for the quoting character (unicode characters are not supported). For example, if a book title is stored with double quotes, such as "The Crazy Adventure"
, enter the value like this: '\"The Crazy Adventure\"'
. If the title is stored with single quotes, enter the value like this: title = '\'The Crazy Adventure\''
.
Unicode (such as "\u6565"
), octal (such as "\7"
, "\65
", "\377"
), and standard Java escape sequences (such as "\n"
, "\r"
, "\b"
) are allowed in the string literals.
Boolean literals are either the true
or false
keyword (lowercase, without quotes).
Number literals are Java form (scientific notation is supported).
Date or time literals are presented in toDate('formatStr', 'dateStr')
format, where formatStr
is the date and time format you want to use (such as 'MM/dd/yyyy'
) and dateStr
is the actual date and time you enter (such as '01/01/2006'
).
The formatStr
must be a valid java.text.SimpleDateFormat
string. If you omit the formatStr
, the toDate()
expects the date and time you enter to be in the following format: 'MM/dd/yyyy HH:mm:ss z'
(where z
is the time zone, such as MDT). For example: toDate('12/01/2004 06:00:00 MDT')
.
To specify date values only, enter the format you want for the formatStr
. For example, for a date value only, specify toDate('MM/dd/yyyy', '12/01/2004')
. You can also specify only the month and year, such as 'MM-yyyy'
.
Use the now
keyword to specify the time at which the expression is being parsed at run time.
To supply query values from user, request, or session properties, use the following format: <type>Property(<propertyset>
, <propertyname>)
, where the type is user, request, or session. For example: userProperty('userpreferences', 'FavoriteAuthor')
.
You can combine multiple independent query clauses, tying them together with and (&&) and or (||) logic and controlling the order of evaluation with parentheses the way you would with algebraic expressions. This lets you create more complex queries. You can also include not logic (!) in complex queries by using the exclamation point in front of a parenthetical grouping.
See the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal for more information about queries.
Figure 6-4 shows the properties set on a book stored in WLP's Virtual Content Repository.
The example queries in Table 6-3, Table 6-4, and Table 6-5 use properties in the sample content item, and the description for each sample query tells you if the query will retrieve the content item.
Query | Will Retrieve Sample? | Description\ |
---|---|---|
|
Yes |
Retrieves any content item that has case-sensitive |
|
Yes |
Retrieves any content item with the will_visit_schools property set to |
|
Yes |
Retrieves any content item that does not have case-sensitive |
|
Yes |
Retrieves any content item with a pub_date property set to a value later than |
|
No |
Because the property name contains spaces, you must use |
|
Yes |
Retrieves any content item with a value less than |
|
No |
Retrieves any content item with value greater than or equal to |
|
Yes |
Retrieves any content item with value less than or equal to |
|
Yes |
Retrieves any content that contains case-sensitive Penman, Panmen, or any other variation with a different character between the |
|
Yes |
Retrieves any content with an author value that begins with |
|
Yes |
Retrieves any content containing an genre value of exactly |
|
No |
The |
|
Yes |
Retrieves any content that contains genre property values of |
|
No |
Retrieves any content that contains genre property values of |
|
Yes |
Retrieves any content that contains genre property values of |
|
Yes |
Retrieves any content that contains the isbn property value of either |
Query | Will Retrieve Sample? | Description |
---|---|---|
|
No |
Retrieves books that are part of a trilogy that were published after |
|
Yes |
Retrieves books with a genre value set to |
|
No |
Retrieves books with a genre value set to |
|
Yes |
Retrieves books whose title contains |
|
Depends |
Reads the User's Profile properties and uses specific property values to supply the values in the query. The query provides personalized content retrieval, because retrieved content is based on user preferences. For example, if the current user has her BookGenre property set to If you are using the Property control or the |
Table 6-5 Other Useful Queries (Not Related to the Sample Content)
Query | Description |
---|---|
|
This approach lets you serve language-appropriate content to each user based on the user language preference |
|
This query uses not logic, as shown in the |
After you have created a Content Selector file (see Section 6.2.1, "Creating the Content Selector File"), you must use the <pz:contentSelector>
JSP tag to display the content. The following JSP tag uses the classic
Content Selector shown in Figure 6-3:
<pz:contentSelector rule="classic" id="nodes"/>
The JSP tag has two required attributes:
The rule attribute – Contains the name of the Content Selector file (without the file extension). This attribute tells the JSP tag which personalization rules and query to use.
The id attribute – When a Content Selector runs its query, the content is retrieved from the virtual content repository as an array of content properties. The id attribute, which is a String you enter when you set up the JSP tag, serves as a container that holds the array. At this point, you must use other JSP tags to handle the array and display the content. For details on what you can do with the array of properties to display the content, see Section 7.1.1, "Displaying Additional MIME Types in a Placeholder."
There are other attributes you can set on the <pz:contentSelector>
tag. See the Oracle Fusion Middleware JSP Tag Java API Reference for Oracle WebLogic Portal for more information on the class.
After you create a Content Selector file in Oracle Enterprise Pack for Eclipse, you can use any of the following three methods to add the Content Selector to a JSP in Oracle Enterprise Pack for Eclipse:
Drag a Content Selector from the Design Palette onto a page of an open portal file. See the instructions in Section 6.2.2.1.1, "Dragging a Content Selector to a Portal File."
Open the JSP to which you want to add the Content Selector, and drag the Content Selector file from the Design Palette into the JSP. The JSP tag is added automatically, the rule attribute is automatically populated with the name of the Content Selector, and the id attribute is included (without a value). The include
statement for the tag library is automatically added. See Figure 6-5.
Figure 6-5 Adding a Content Selector to a JSP in Oracle Enterprise Pack for Eclipse
Drag the <pz:contentSelector>
JSP tag from the JSP Design Palette window (in the Portal Personalization category) into an open JSP and populate the tag's attributes manually. Get to the JSP Design Palette by choosing Window > Show View > Design Palette. The include
statement for the tag library is automatically added.
Perform the following steps to drag a Content Selector to an open portal file:
In the Portal Perspective, locate a Content Selector file.
Drag a Content Selector from the Design Palette onto a page of an open portal file. When you do this, three things occur:
The Portlet Wizard appears, letting you quickly create a portlet that will display the Placeholder.
The resulting portlet is automatically added to the portal page.
A JSP file is automatically created for the Content Selector.
The JSP file contains the Content Selector JSP tag with the rule and id attributes automatically populated, and the include
statement for the tag library is automatically added. Other JSP and HTML tags are also added automatically, as shown in Example 6-1.
Example 6-1 JSP File with Other JSP and HTML Tags
<pz:contentSelector rule="modern" id="nodes"/> <utility:notNull item="<%nodes%"> <ul> <utility:forEachInArray array="<%=nodes%>" id="node" type="com.bea.content.Node"> <li><cm:getProperty id="node" name="cm_nodeName" conversionType="html"/></li> </utility:forEachInArray> </ul> </utility:notNull>
Table 6-6 describes the JSP tags you can use with a Content Selector.
Table 6-6 JSP Tags for Content Selectors
JSP Tag | Description |
---|---|
|
Checks to see if the array actually contains content. |
|
Provides a container for listing content items in a bulleted list. |
|
Iterates through the array and isolates each content item until all items in the array have been processed. Each item is given its own |
|
Takes each content item from |
You can use multiple Content Selectors with conditional logic to get hierarchical personalized content, where you try to match the most specific to the least specific, or for mutually exclusive Content Selectors. Example 6-2 demonstrates how to use multiple Content Selectors for personalized content.
Example 6-2 Using the <pz:contentSelector> JSP Tag for Multiple Content Selectors
<%@ taglib uri="http://www.bea.com/servers/portal/tags/content" prefix="cm"%> <%@ taglib uri="http://www.bea.com/servers/p13n/tags/utility" prefix="utility"%> <%@ taglib uri="http://www.bea.com/servers/portal/tags/ad" prefix="ad"%> <%@ taglib uri="http://www.bea.com/servers/portal/tags/personalization" prefix="pz"%> <pz:contentSelector rule="FemaleContent" id="nodes" sortBy="cm_nodeName desc"/> <% if (nodes == null || nodes.length <= 0) { %> <pz:contentSelector rule="MaleContent" id="nodes" sortBy="cm_nodeName desc"/> <% }%> <% if (nodes == null || nodes.length <= 0) { %> Sorry, you don't get a free lunch today. <% }%> Found <%=nodes.length%> Node(s): <dl> <utility:forEachInArray array="<%=nodes%>" id="node" type="com.bea.content.Node"> <dt><cm:getProperty id="node" name="title" conversionType="html"/></dt> <dd><ad:render id="node" /></dd> </utility:forEachInArray> </dl>
The <pz:div>
JSP tag can provide in-line HTML Personalization. You can populate a JSP with sets of in-line content and wrap it with the tag. The tag uses a rule attribute that takes the name of an existing User Segment. Only members of that User Segment can see the in-line content. For example, you created a User Segment called bookfanUserSegment.seg
in Oracle Enterprise Pack for Eclipse that makes anyone a member who has a bookfan User Profile property set value set of true
. The following sample code illustrates this:
<pz:div rule="bookfanUserSegment"> <p>Only users who are book nerds will see this text!</p> </pz:div>
User Segment rules (conditions) are the same as those available to Content Selectors, so the <pz:div>
tag provides a similar level of Personalization. The difference is that Content Selectors retrieve their content from the virtual content repository, while the <pz:div>
tag encloses its content in-line in the JSP.
Tip:
Content Selectors can display binary content, such as images. See the Oracle Fusion Middleware Content Management Guide for Oracle WebLogic Portal for instructions.Deleting a Content Selector query removes the query from the Content Selector in Oracle Enterprise Pack for Eclipse and the Administration Console.
Note:
The steps in this chapter refer to the <data>\src folder in the Package Explorer View. Your data and src directories might be named differently.Developers perform the following steps to remove a query in a Content Selector:
In the Portal Perspective, open the Content Selector file in the <data>\src\contentselectors\GlobalContentSelectors folder in the Package Explorer View.
Click the query link in the Content Selector Editor.
Select the query in the Content Search dialog.
Click Remove.
Click OK.
Removing a Content Selector removes it from Oracle Enterprise Pack for Eclipse and from the Administration Console.
Perform the following steps to delete a Content Selector:
In the Portal Perspective, open the Content Selector file in the <data>\src\contentselectors\GlobalContentSelectors folder in the Package Explorer View.
Right-click the Content Selector and choose Delete.
Click Yes to confirm the deletion.
Tip:
You should also delete any <pz:contentSelector> tags in your JSPs that reference the Content Selector you deleted.You can use the following methods to edit the content that a Content Selector displays:
Oracle Enterprise Pack for Eclipse – Developers can use Oracle Enterprise Pack for Eclipse to modify a Content Selector's conditions and queries. For instructions, see Chapter 13.
Administration Console – Portal administrators can use the Administration Console to edit a Content Selector's properties or description. For instructions, see Chapter 13.