BEA Logo BEA WebLogic Commerce Server Release Beta

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic Commerce Server Doc Home   |   Personalization Server Tour   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Deploying the New Example Portal

 

In this chapter, we will log in as different users to see the portal in action. Then we will enhance the exampleportal login to increment the users' AcmePoints.

This topic includes the following sections:

 


Viewing the New Example Portal

We have set up everything we need to view the new example portal. Now we will view the example portal on the WebLogic Server. To view the frequent visitor personalization message, we will log in as democustomer. To view the infrequent visitor hints, we will not log into the portal; the portal will then treat us as if we have zero AcmePoints.

To get to the portal, go to http://<machine-name>:<port>/application/exampleportal.

Logging In as a Frequent Visitor

  1. In your browser, go to the example portal.

  2. Click the key icon in the top right-hand corner of the page.

  3. Log in using the username democustomer with the password password. This is the user we created with five AcmePoints. When you log in, you will see the frequent visitor messages in the portlet because the classifier rule classifies the user as a FrequentVisitor and the content selector rule FrequentVisitorMessage retrieves messages to display to frequent visitors.

Viewing Infrequent Visitor Hints

  1. In your browser, go to the example portal.

  2. Do not log into the portal.

  3. You will see a message in the portlet. Because you did not log in and the default AcmePoints value is zero, the system uses the InfrequentVisitor classifier rule to classify you as a new user. The content selector rule Hints retrieves the hint message and displays site information.

 


Enhancing the Example Portal Login

You can add a code to a login page to have the page increment each user's AcmePoints each time they visit the exampleportal. To enhance the login, insert code similar to the example below into the login page. The code increments the logged in users' AcmePoints by 1 each time they log in.

<%-- Load the user's profile into scope. --%>
<um:getProfile scope="session" profileKey="<%=username%>" />

<%-- Get current AcmePoints --%>
<um:getProperty id="points" propertySet="exampleportal" propertyName="AcmePoints"/>

<%
// increment AcmePoints
long newTot = ((Long)points).longValue() + 1;
Long newTotal = new Long(newTot);
%>

<%-- Set incremented AcmePoints --%>
<um:setProperty propertySet="exampleportal" propertyName="AcmePoints" value="<%=newTotal%>"/>

The login page is:

 <install-dir>\server\public_html\portals\repository\_userlogin.jsp 

Follow these steps to add this code:

  1. Open the _userlogin.jsp file in your favorite text editor.

  2. Insert the example code into the userlogin.jsp file, as shown:

    <%--setUser(username, request) --%>
    example code goes here
    <%--If multiple groups, set group check to true --%>

  3. Close your browser to ensure that nothing is cached. Restart your browser and open the example portal.

  4. Login as username Acme, password acme. Notice the Hint displayed in the portlet.

  5. Log out and log back in 4 more times. Notice that after the fourth login, the portlet displays the Frequent Visitor messages, instead of the Hints.

    Note: You can also see this property by looking at the AcmePoints propery for username Acme. For more information, see Editing User Properties.