Portal Guide
CHAPTER 27
This chapter provides reference information for the Portal Tag Library (PortalTag.jar).
For background information, see the chapter on using the Director tag libraries in Developing exteNd Director Applications.
Specifies the profiling definition for the transcoding engine. This tag is used with the deviceProfiling tag.
Syntax
<prefix:definition>
Performs a transcoding operation. The definition and sourceXML tags can be nested within this tag.
This tag is used to render content for use with multiple devices using the transcoding engine. The definition tag should contain the appropriate XML data for rendering the content.
JSP pages that use this tag may have to set the return MIME type before calling this custom tag in order to have the content properly displayed. The default content type for JSP pages is text/html. Here is an example of the code you might need to add to the JSP page in order to support a WAP (Wireless Application Protocol) device:
public int getBrowser(HttpServletRequest request) { String accept = request.getHeader("ACCEPT"); if (null != accept && -1 != accept.indexOf("wml")) { return WML; } return -1; } <% switch (getBrowser(request)) { case WML: response.setContentType("text/vnd.wap.wml"); break; } %>
An alternative way to set the content type is to use the id attribute of the deviceProfiling tag to specify a variable where the content type for the current device should be stored. You can then get the value of this variable by calling the getAttribute() method on the pageContext:
<% response.setContentType((String)pageContext.getAttribute("contenttype")); %>
Syntax
<prefix:deviceProfiling name="name" style="style" id="id" />
Example
This example shows how to use the deviceProfiling tag to perform a transcoding operation. In this example, the profiling definition is hardcoded within the definition tag. Typically, you would use the getResource tag (in the Framework tag library) to get the XML from the resource set dynamically.
<%@ taglib uri="/fw" prefix="epfw" %> <%@ taglib uri="/portal" prefix="ep" %> <% try { %> <ep:deviceProfiling style="PhoneListStyle" name="testtwo" id="phone"> <ep:definition> <transcoding lastOpen="d:\PhoneListData.xml" xmlns="urn:novell:dp_metadata"> <separator tagname='employee'/> <block name='employeeList' type='list' style='' listlength="4"> <element name='firstName' type='' location='//first-name/text()'/> <element name='lastName' type='' location='//last-name/text()'/> </block> <block name='employeeDetails' type='content' style=''> <element name='firstName' type='' location='//first-name/text()'/> <element name='phoneNumber' type='' location='//phone-number/text()'/> <element name='email' type='' location='//email/text()'/> </block> <link from-block='employeeList' from-element='firstName' to-block='employeeDetails'/> </transcoding> </ep:definition> <ep:sourceXML> <results querystring="s"> <employee> <first-name>Katy</first-name> <last-name>Summers</last-name> <phone-number>(617) 343-6530</phone-number> <email>ksummers@silverdemo.com</email> </employee> <employee> <first-name>Hank</first-name> <last-name>Smiley</last-name> <phone-number>(617) 343-6532</phone-number> <email>hsmiley@silverdemo.com</email> </employee> ... </results> </ep:sourceXML> </ep:deviceProfiling> <%} catch (Exception e) { System.out.println("Error"); e.printStackTrace(); } %> <% response.setContentType((String)pageContext.getAttribute("phone")); %>
DEPRECATED This tag has been deprecated. Use renderPortlet.
Displays a portal component within a JSP page. To pass parameters to the component, you can nest the param tag inside the displayComponent tag.
This tag wraps the displayComponent() method on the EbiPresentationMgr interface.
Syntax
<prefix:displayComponent compID="compID" name="name" decorate="decorate" id="id"/>
Example 1
This example shows how to use the displayComponent to send component content to the output stream:
<%@ taglib uri="/portal" prefix="ep" %> <html> <body> <b>DisplayComponent</b> <ep:displayComponent compID="MyComponent1" name="mycomp1"> <ep:param name="Parm1" value="Val1"/> <ep:param name="Parm2" value="Val2"/> <ep:param name="Parm3" value="Val3"/> </ep:displayComponent> </body> </html>
Example 2
This example shows how to use the displayComponent to assign component content to the id variable. In this example, the id variable is used to store a theme ID generated by the PortalUrlHelper component:
<head> <ep:displayComponent compID="PortalUrlHelper" name="helper" id="themeid"> <ep:param name="SUBST_STRING" value="$THEME_ID$"/> </ep:displayComponent> <%=pageContext.getAttribute("themeid")%> </head>
DEPRECATED This tag has been deprecated.
Displays a PID page within a JSP page.
This tag wraps the displayPage() method on the EbiPresentationMgr interface.
Syntax
<prefix:displayPID PID="pid" />
Attribute |
Required? |
Request-time expression values supported? |
Description |
---|---|---|---|
PID |
Yes |
No |
Specifies the name of a PID page. |
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:displayPID PID="MyPID.html" />
DEPRECATED This tag has been deprecated.
Fires the processRequest method of a component. To pass parameters to the processRequest method, you can nest the param tag inside the fireComponentProcessRequest tag.
This tag wraps the processRequest() method on the EbiPortalComponent interface.
Syntax
<prefix:fireComponentProcessRequest compID="compID" name="name" />
Example
<%@ taglib uri="/portal" prefix="ep" %> <html> <body> <ep:fireComponentProcessRequest compID="MyComponent1" name="mycomp1"> <ep:param name="Parm1" value="Val1"/> <ep:param name="Parm2" value="Val2"/> <ep:param name="Parm3" value="Val3"/> </ep:fireComponentProcessRequest> </body> </html>
Retrieves a list of all portal components. To use this tag, the user must be part of the administrators group and have proper authority to get this list of objects. Before using this tag, the user must log in.
This tag wraps the getComponentInfoList() method on the EbiComponentManager interface.
Syntax
<prefix:getCompList id="id" iterate="iterate" restricted="restricted" category="category"/>
Example 1
This example shows how to use the getCompList tag with the iterate attribute set to true:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getCompList iterate="true">
Component name = <%=compName%><br/>
Description = <%=description%><br/>
DisplayName = <%=displayname%><br/>
<p/>
</ep:getCompList>
<fw:logoff />
</body>
</html>
Example 2
This example shows how to use the getCompList tag with the iterate attribute set to false:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/portal" prefix="ep" %>
<%@ taglib uri="/fw" prefix="fw" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getCompList iterate="false"/>
<%= ((java.util.List)pageContext.getAttribute("compList")).size() %> = the size of the list...
<fw:logoff />
</body>
</html>
Retrieves an object from the portal cache. Objects are retrieved based on the cache key passed in on the key attribute and cast to the class provided by the className attribute. The result is placed within a scripting variable with a page scope that is named by the tag's id attribute value.
This tag wraps the getObjectInCache() method on the EbiCacheHolder interface.
Syntax
<prefix:getObjectInCache id="ID" key="key" className="class" sessionCache="sessionCache" />
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:getObjectInCache id="myID" key="portalkey" className="java.lang.String" />
...
Value is: <%=myID%>
DEPRECATED This tag has been deprecated. Use getObjectInCache with sessionCache set to true.
Retrieves an object from the session cache. Objects are retrieved based on the cache key passed in on the key attribute and cast to the class provided by the className attribute. The result is placed within a variable with a page scope that is keyed by the tag's id attribute value.
This tag wraps the getObjectInCache() method on the EbiSession interface.
NOTE: This tag has been deprecated. Use the getObjectInCache tag instead.
Syntax
<prefix:getObjectInSessionCache id="ID" key="key" className="class" />
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:getObjectInSessionCache id="sesobj" key="sessionkey" className="java.lang.String" />
...
Value is: <%=sesobj%>
Retrieves a list of all PID pages. To use this tag, the user must be part of the administrators group and have proper authority to get this list of objects. Before using this tag, the user must log in.
This tag wraps the getPageInfoList() method on the EbiPageManager interface.
Syntax
<prefix:getPIDList id="id" iterate="iterate" category="category"/>
Example 1
This example shows how to use the getPIDList tag with the iterate attribute set to true:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getPIDList iterate="true">
Identifier = <%=identifier%><br/>
mime = <%=mime%><br/>
Description = <%=displayname%><br/>
<p/>
</ep:getPIDList>
<fw:logoff />
</body>
</html>
Example 2
This example shows how to use the getPIDList tag with the iterate attribute set to false:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/portal" prefix="ep" %>
<%@ taglib uri="/fw" prefix="fw" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getPIDList iterate="false"/>
<%= ((java.util.List)pageContext.getAttribute("PIDList")).size() %> = the size of the list of pages...
<fw:logoff />
</body>
</html>
Retrieves the URL for the current theme and generates an appropriate link to a theme CSS file. If the id is not set, it will return the string for the link tag directly. If the id is set it will return the link as an attribute of that name. For inline calls, this tag should be placed in the <head> section of the HTML so that the link to the CSS file is positioned properly.
This tag wraps the replaceAllKeywordStrings() method on the EboPortalUrlHelper class.
Syntax
<prefix:getThemeLink id="id"/>
Example
This example shows how to use the getThemeLink tag to generate a theme link in the HEAD section of a page:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
<ep:getThemeLink/>
</head>
<body>
...
</body>
</html>
DEPRECATED This tag has been deprecated.
Retrieves the requested user component information for the current user or a specified user.
This tag wraps the getUserComponentInfo() method on the EbiPortalManager interface.
Syntax
<prefix:getUserComponentInfo compID="compID" userIID="useriid" id="id"/>
Example
This example shows how to use the getUserComponentInfo tag to get information about a particular component:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getUserComponentInfo compID="PhoneList"/>
<%= ((com.sssw.portal.api.EbiUserPortalInfo)pageContext.getAttribute("componentinfo")).getComponentName() %> is the default page for this user...
<fw:logoff />
</body>
</html>
Retrieves portal page information for the current user or a specified user.
This tag wraps the getUserPageInfo() method on the EbiPortalManager interface.
Syntax
<prefix:getUserPageInfo userIID="useriid" id="id"/>
Example
This example shows how to use the getUserPageInfo tag to get information about a particular personal page:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getUserPortalInfo userPageName="MyUserPage"/>
<%= ((com.sssw.portal.api.EbiUserPageInfo)pageContext.getAttribute("pageinfo")).getPortalLayoutID() %> is the layout ID for the page...
<fw:logoff />
</body>
</html>
Retrieves a list of all available pages for the current user or a specified user.
This tag wraps the getUserPageInfoList() method on the EbiPortalManager interface.
Syntax
<prefix:getUserPageList id="id" userIID="userIID" iterate="iterate"/>
Example 1
This example shows how to use the getUserPageList tag with the iterate attribute set to true:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getUserPageList iterate="true">
Page name = <%=pagename%><br/>
Description = <%=description%><br/>
Display name = <%=displayname%><br/>
<p/>
</ep:getUserPageList>
<fw:logoff />
</body>
</html>
Example 2
This example shows how to use the getUserPageList tag with the iterate attribute set to false:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/portal" prefix="ep" %>
<%@ taglib uri="/fw" prefix="fw" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getUserPageList iterate="false"/>
<%= ((java.util.List)pageContext.getAttribute("userPageList")).size() %> = the size of the list of pages...
<fw:logoff />
</body>
</html>
Retrieves portal information for the current user or a specified user.
This tag wraps the getUserPortalInfo() method on the EbiPortalManager interface.
Syntax
<prefix:getUserPortalInfo userIID="useriid" id="id"/>
Example
This example shows how to use the getUserPortalInfo tag to get information about the current user:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
<fw:login userid="admin" password="admin"/>
<!-- login a user to the portal...-->
<ep:getUserPortalInfo/>
<%= ((com.sssw.portal.api.EbiUserPortalInfo)pageContext.getAttribute("portalinfo")).getDefaultUserPage() %> is the default page for this user...
<fw:logoff />
</body>
</html>
Handles all render URLs and action URLs directed to portlets on a JSP page. This tag must be placed before the <html> section of each JSP page that uses portlet content.
The action handler obtains the registration id of the portlet specified in the action URL or render URL.
Syntax
<prefix:handlePortletAction />
Example
<%@ taglib uri="/portal" prefix="portal" %> <portal:handlePortletAction /> <html> <head> <portal:getThemeLink /> </head> <body> <table> <tr> <td><portal:renderPortlet registrationID="StockQuotePortlet" /></td> </tr> <tr> <td><portal:renderPortlet registrationID="TestPortlet" /></td> </tr> </table> </body> </html>
Specifies a parameter that will be passed to the tag within which it is nested. The param tag can be nested within the displayComponent and the fireComponentProcessRequest tags.
This tag is a nested tag. It can only be used as the child of another tag.
Syntax
<prefix:param name="name" value="value" />
Attribute |
Required? |
Request-time expression values supported? |
Description |
---|---|---|---|
name |
Yes |
Yes |
Specifies the name of the parameter. |
value |
Yes |
Yes |
Specifies a value for the parameter. |
Example
<%@ taglib uri="/portal" prefix="ep" %> <html> <body> <b>DisplayComponent</b> <ep:displayComponent compID="MyComponent1" name="mycomp1"> <ep:param name="Parm1" value="Val1"/> <ep:param name="Parm2" value="Val2"/> <ep:param name="Parm3" value="Val3"/> </ep:displayComponent> </body> </html>
Provides a mechanism for retrieving and parsing portal URLs. To do this, it instantiates a portal context object and translates the provided string, substituting any portal replacement strings with current valid URL information.
For more information on portal replacement strings, see Portal Replacement Strings.
This tag wraps the replaceAllKeywordStrings() method on the EboPortalUrlHelper class.
Syntax
<prefix:PortalUrlHelper urlString="urlString" id="id"/>
Example
This example shows how to use the PortalUrlHelper tag to get the current theme ID:
<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
buffer="none"
autoFlush="true"
import="com.sssw.portal.*"%>
<%@ taglib uri="/fw" prefix="fw" %>
<%@ taglib uri="/portal" prefix="ep" %>
<html>
<head>
</head>
<body>
The current theme is: <ep:PortalUrlHelper urlString="$THEME_ID$"/>
</body>
</html>
Puts an object in the portal cache. The object passed in on the object attribute is cached based on the cache key passed in on the key attribute.
This tag wraps the putObjectInCache() method on the EbiCacheHolder interface.
Syntax
<prefix:putObjectInCache key="key" object="object" sessionCache="sessionCache" />
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:putObjectInCache key="portalkey" object="<%=pageContext.getAttribute("test")%>" />
DEPRECATED This tag has been deprecated. Use putObjectInCache with sessionCache set to true.
Puts an object in the portal cache that is linked to the current session. The object passed in on the object attribute is cached based on the cache key passed in on the key attribute.
This tag wraps the putObjectInCache() method on the EbiSession interface.
Syntax
<prefix:putObjectInSessionCache key="key" object="object" />
Attribute |
Required? |
Request-time expression values supported? |
Description |
---|---|---|---|
key |
Yes |
Yes |
Specifies the key for the object in the portal cache. |
object |
Yes |
Yes |
Passes in the object that will be cached. |
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:putObjectInSessionCache key="sessionkey" object="mytestvalue" />
Removes an object from the portal cache.
This tag wraps the removeObjectInCache() method on the EbiCacheHolder interface.
Syntax
<prefix:removeObjectInCache key="key" sessionCache="sessionCache" />
Example
<% taglib uri="/portal" prefix="ep" %>
...
<ep:removeObjectInCache key="portalkey" %>" />
Renders portlet content within a JSP page. This tag accepts XML or HTML content from a portlet and renders it on the page as HTML.
Syntax
<prefix:renderPortlet registrationID="ID" pageNamespace="namespace" />
Attribute |
Required? |
Request-time expression values supported? |
Description |
---|---|---|---|
registrationID |
Yes |
Yes |
Specifies the registration ID of the portlet. NOTE: The registration ID is the name you give a registered instance of a portlet, as described in Procedure for registering a portlet. |
pageNamespace |
No |
Yes |
Specifies a namespace as a string value, which is used to differentiate portlets with identical registration IDs that reside on the same page. Allows each portlet with the same registration ID to maintain its own session state. |
Example
In this example, the JSP includes pairs of portlets with the same registration IDs. The pageNamespace attribute is used to differentiates the StockQuotePortlet registrations and the TestPortlet registrations.
<%@ taglib uri="/portal" prefix="portal" %> <portal:handlePortletAction /> <html> <head> <portal:getThemeLink /> </head> <body> <table> <tr><td>Stock Quote 1</td><td>Stock Quote 2</td></tr> <tr> <td><portal:renderPortlet registrationID="StockQuotePortlet" /></td> <td><portal:renderPortlet registrationID="StockQuotePortlet" pageNamespace="2" /></td> </tr> <tr> <td><portal:renderPortlet registrationID="TestPortlet" /></td> <td><portal:renderPortlet registrationID="TestPortlet" pageNamespace="1" /></td> </tr> </table> </body> </html>
Specifies source XML that is to be transformed by the transcoding engine. Used with the deviceProfiling tag. The sourceXML tag should contain appropriate XML data for rendering the content.
Syntax
<prefix:sourceXML>
Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. more ...