template
Indicates the start and end of the layout.
Variables
-
epPageVariables : Enables you to get information about the current client, and whether the layout is being used in design time or runtime.
The variable has the following two methods:
-
epPageVariables.getRunMode() : Returns either RunMode.RUN_TIME or RunMode.DESIGN_TIME
-
epPageVariables.getUserAgent() : Returns an object of type IUserAgent , which enables you to find out about the client, such as the browser type and version.
For more information, see User Agent Service .
The scope of epPageVariables is from the beginning of the template tag to the end of the JSP page.
-
Example
The following is a layout with one container that executes unspecified code if the layout is displayed in runtime and other code if the client is Internet Explorer.
<%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibHtmlb" prefix="hbj" %>
<%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibLayout" prefix="lyt" %>
<%@ page import="com.sapportals.portal.useragent.IUserAgent" %>
<%@ page import="com.sapportals.portal.useragent.IUserAgentConstants" %>
<%@ page import="com.sapportals.portal.pb.layout.taglib.variabledef
.RunMode" %>
<%
RunMode pageRunMode;
IUserAgent pageUserAgent;
String pageUserAgentType;
%>
<lyt:template>
<%
//Resolve page RunMode
pageRunMode = epPageVariables.getRunMode();
//Resolve page UserAgent
pageUserAgent = epPageVariables.getUserAgent();
pageUserAgentType = pageUserAgent.getType();
%>
<hbj:content id= "myContext">
<hbj:page title="Portal Page">
<%
if(pageRunMode == RunMode.RUN_TIME) {
...
}
if(pageUserAgentType.equals(IUserAgentConstants.UA_TYPE_MSIE)) {
...
}
%>
<lyt:container id="the_container_id" />
</hbj:page>
</hbj:content>
</lyt:template>< /p>