The page template functions as a container page for gear rendering. The page template provided for a shared page (a page that renders several gears) is shared.jsp. For a full page (a page that renders a single gear), the provided file is called full.jsp. Typically, the page template file is responsible for several things, including:

Page Template Example

As an example of a page template, let’s look at shared.jsp, which illustrates some of the main functionality carried out by a page template in the case of a portal page shared by several gears.

Tag Library Declaration

This element makes available two standard Java tag libraries and two ATG tag libraries. The ATG portal/paf1_3 tag library is described in this guide; see Appendix B: PAF Tag Library Reference. The ATG dspjspELTaglib1_0 is described in the Page Developer's Guide.

<%@ taglib prefix="paf" uri="http://www.atg.com/taglibs/portal/paf1_3" %>
<%@ taglib prefix="dsp" uri="http://www.atg.com/taglibs/daf/dspjspELTaglib1_0" %>
<%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"  %>
Internationalization Initialization

This element makes available the resource bundle used for localizing user messages on the page.

<fmt:setBundle var="templatesbundle" basename="atg.portal.templates"/>
Page and Environment Initialization

The next sets of elements initialize the DSP page environment and the portal page environment. The dsp:page element invokes the JSP handler, which calls the ATG servlet pipeline. Next, we get the Portal Servlet Request and Portal Servlet Response attributes, and then set the community, page, community name, and page name, based on the values in the Portal Servlet Request.

<dsp:page>

<c:set var="PORTALSERVLETREQUEST"><%= Attribute.PORTALSERVLETREQUEST %></c:set>
<c:set var="PORTALSERVLETRESPONSE"><%= Attribute.PORTALSERVLETRESPONSE %></c:set>
<c:set var="portalServletRequest"
       value="${requestScope[PORTALSERVLETREQUEST]}"/>
<c:set var="portalServletResponse"
       value="${requestScope[PORTALSERVLETRESPONSE]}"/>
<c:set var="community"
       value="${portalServletRequest.community}"/>
<c:set var="page"
       value="${portalServletRequest.page}"/>
<c:set var="communityName"
       value="${community.name}"/>
<c:set var="pageName"
       value="${page.name}"/>

The next set of elements sets visual style elements, based on properties in the page’s colorPalette property.

<c:set var="bodyTagData"
       value="${page.colorPalette.bodyTagData}"/>
<c:set var="pageTextColor"
       value="#${page.colorPalette.pageTextColor}"/>
<c:set var="pageBackgroundColor"
       value="#${page.colorPalette.pageBackgroundColor}"/>
<c:set var="gearTitleTextColor"
       value="#${page.colorPalette.gearTitleTextColor}"/>
<c:set var="gearTitleBackgroundColor"
       value="#${page.colorPalette.gearTitleBackgroundColor}"/>
<c:set var="communityPages"
       value="${portalServletRequest.communityPages.pages}"/>

The next element sets the URL for a stylesheet, encoding it with the relevant portal request attributes, so that the page ID, community ID, display mode, etc., can be passed to the stylesheet:

<c:set var="cssURL"
       value="${community.style.CSSURL}"/>
<c:if test="${cssURL != null}"><paf:encodeURL var="cssURL" url="${cssURL}"/>
</c:if>

The next elements use the paf:encodeURL element to set the URLs for links off of the page. The adminURL link leads to the Community Administration, for those users that are authorized to use it. The customizeURL link leads to the page customization interface, if the user is authorized to customize this page. The loginURL and logoutURL lead to authorization pages.

<c:set var="contextPath"><%= request.getContextPath() %></c:set>
<paf:encodeURL var="adminURL"     url="/portal/settings/community_settings.jsp"/>
<paf:encodeURL var="customizeURL" url="/portal/settings/user.jsp"/>
<paf:encodeURL var="loginURL"     url="${contextPath}/userprofiling/login.jsp"/>
<paf:encodeURL var="logoutURL"    url="${contextPath}/userprofiling/logout.jsp"/>

The next element imports the Profile object:

<dsp:importbean var="profile" bean="/atg/userprofiling/Profile"/>
Outer HTML Tags

Now that the page is initialized with the necessary declarations of taglibs, variables, etc., the next elements begin the HTML elements of the page, beginning with the <head> element:

<html>

  <head>

    <title><c:out value="${communityName}"/>
        - <c:out value="${pageName}"/>
    </title>
    <link rel="stylesheet" type="text/css" href='<c:out value="${cssURL}"/>'
          src='<c:out value="${cssURL}"/>'/>

  </head>
HTML Body

The body of the page begins by creating a table, with the community name in the left portion of the header.

<body <c:out value="${bodyTagData}" escapeXml="false"/> >

<%--
  -- Header
  --%>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
  <tr>
   <td valign="top" bgcolor='<c:out value="${pageTextColor}"/>'>

    <table border="0" width="100%" cellpadding="3" cellspacing="0">
      <tr>
        <%--
          --  Left Header
          --%>
        <td valign="top" align="left"
            bgcolor='<c:out value="${pageBackgroundColor}"/>'>
          <font color='<c:out value="${pageTextColor}"/>'>
            <b><c:out value="${communityName}"/>
          - <c:out value="${pageName}"/></b><br/>

The next section uses a security tag, paf:hasCommunityRole, to display a link to the Community Administration only if the user’s role is either a community leader or a portal administrator. See Security Tags in the Portal Security chapter for more information.

<paf:hasCommunityRole roles="leader,portal-admin">
  <a href='<c:out value="${adminURL}"/>'>
  <fmt:message key="page-label-administer"
               bundle="${templatesbundle}"/>
  </a><br/>
</paf:hasCommunityRole>

The next element tests whether this community allows users to customize pages. If so, it displays a link to the customization page.

<c:if test="${community.allowPersonalizedPages == true
&& profile.transient == false}" >
  <a href='<c:out value="${customizeURL}"/>'>
      <fmt:message key="page-label-customize"
           bundle="${templatesbundle}"/>
  </a>
</c:if>

The next section of the header tests whether the user is logged in. If so, a logout link is displayed. If no, a login link is displayed.

<td valign="top" align="right"
    bgcolor='<c:out value="${pageBackgroundColor}"/>'>
  <font color='<c:out value="${pageTextColor}"/>'>
  <c:choose>
    <c:when test="${profile.transient == false}">

      <fmt:message key="page-message-logged-in"
           bundle="${templatesbundle}"/>
        <b><dsp:valueof bean="Profile.login"/></b><br/>
      <a href='<c:out value="${logoutURL}"/>'>
         <fmt:message key="page-label-logout"
              bundle="${templatesbundle}"/></a>

    </c:when>
    <c:otherwise>

      <a href='<c:out value="${loginURL}"/>'>
         <fmt:message key="page-label-login"
              bundle="${templatesbundle}"/></a><br/>&nbsp;

    </c:otherwise>
  </c:choose>
  </font>
</td>
Rendering Community Page Tabs

The next section displays a tab for each page in the community. The c:forEach element iterates through the pages in the community and sets the URL for the page.

<c:forEach var="communityPage"
           items="${communityPages}">
              <paf:context var="portalContext"/>
              <c:set target="${portalContext}"
                     property="page" value="${communityPage}"/>
              <paf:encodeURL var="communityPageURL"
                             context="${portalContext}"
                             url="${portalServletRequest.portalRequestURI}"/>

The c:forEach element uses three tags from the PAF tag library to render a tab for each page in the community. The parent paf:renderTab encloses a paf:currentTab element, which is rendered if the page object passed to the parent renderTab tag is the currently rendering page, and a paf:defaultTab element, which is rendered if the page object passed to the parent renderTab tag is not the currently rendering page. The result is to highlight the tab for the current page. Each tab includes a link to the URL for the community page.

<paf:renderTab page="${portalContext.page}">
  <paf:defaultTab>
    <td bgcolor='<c:out value="${gearTitleBackgroundColor}"/>' nowrap><nobr>
      <font size="-1">&nbsp;&nbsp;<a href="<c:out value="${communityPageURL}"/>">
      <font color="<c:out value="${gearTitleTextColor}"/>" >
      <c:out value="${communityPage.name}"/></font></a>
         &nbsp;&nbsp;</font></nobr>
    </td>
  </paf:defaultTab>

  <paf:currentTab>
    <td bgcolor='<c:out value="${gearTitleTextColor}"/>' nowrap><nobr>
      <font size="-1">&nbsp;&nbsp;
      <b><a href="<c:out value="${communityPageURL}"/>">
      <font color="<c:out value="${gearTitleBackgroundColor}"/>">
      <c:out value="${communityPage.name}"/></font></a></b>
         &nbsp;&nbsp;</font></nobr>
    </td>
  </paf:currentTab>
</paf:renderTab>
Rendering the Layout Template

The page layout template is invoked using this element from the PAF tag library:

<paf:layout/>

Which page layout to render is determined based on the page’s display mode, device, and URL. The page layout template does the actual work of rendering the gears on the page. See the Layout Template section for a description of how to create and use a layout template.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices