BEA Logo BEA WLCS Release 3.5

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WLCS Documentation   |   Personalization Tour   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Deploying the New Example Portal

 

In this chapter, you will log in as different users to see the portal in action. Then you will enhance the exampleportal login to increment users' AcmePoints automatically when users log in to the Web site.

This topic includes the following sections:

 


Viewing the New Example Portal

You have set up everything you need to view the Acme Web site (exampleportal). Now you will view the Web site on the WebLogic Server, both as a frequent visitor and an infrequent visitor.

To view the frequent visitor personalization message, you will log in as democustomer. To view the infrequent visitor hints, you will not log into the portal. The portal will then read the default AcmePoints value of zero.

Logging in as a Frequent Visitor

  1. With the WebLogic Server running, go to the following URL in your browser:

    http://<machine-name>:<port>/exampleportal

    Note: If you don't know your machine name, use your network or machine login name. Windows users: Do not use the Start menu exampleportal URL. Type the URL in your browser.

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

  3. Enter the username democustomer with password as the password, and click Sign In.

    This is the user you created with five AcmePoints. When you log in, you will see the frequent visitor messages in the "tutorial" portlet, because democustomer is classified as a frequent visitor.

Logging in as an Infrequent Visitor

  1. In your browser, go to the exampleportal again.

  2. Do not log into the portal.

    Because you did not log in, and the default AcmePoints value is zero, you are classified as an infrequent visitor and the "tutorial" portlet displays hints.

 


Enhancing the Example Portal Login

You can add 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%>"/>

Follow these steps to add this code:

  1. Open the loginSuccess.jsp file in your favorite text editor. It resides in the <install-dir>\config\wlcsDomain\applications\wlcsApp\ exampleportal\portals\repository\ directory.

  2. Insert the example code directly between the following lines in the file:
    <%-- Begin: Insert Personalization tour code here --%>
    <%-- End: Insert Personalization tour code here --%>

    Note: You can also add the following line of code at the end of the example code as a troubleshooting tool. The code prints a comment in the console window when the code runs successfully:

    <% System.out.println("adding points for user: " + username); %>

  3. Save the file.

  4. Close your browser to ensure that nothing is cached. Restart your browser and open the exampleportal.

  5. Log in as username acme, password acme. Notice the Hint displayed in the portlet.

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

    Note: You can also see the new AcmePoints value for the "acme" user by looking at the user's profile in the Administration Tools. For more information, see Editing User Properties in Working with User Profiles.

 

back to top previous page