![]() |
![]() |
|
|
Portal Management JSP Tag Library Reference
WebLogic Portal includes a set of JSP tags designed to facilitate the development of portals and portlets. Use these predefined tags to reduce the amount of Java code required in your JSP page. This topic explains how to import each set of tags into your Web pages, and describes the purpose of each tag.
In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.
This topic includes the following sections:
Importing Tag Libraries
To use these tags you must import them into each JSP page. Import the JSP tags described in this document by including the following code in your JSP page:
Imports the utility tag library.
Imports the portal tag library.
Imports the portlet tag library.
Portlet Tag Libraries
The following section describes the portlet tags and their attributes.
<portlet:createWebflowURL>
The <portlet:createWebflowURL> tag is used in a portlet to dynamically create a Webflow URL in a JSP. The Webflow URL may include the protocol, domain name, port, Web application URI, WebflowServlet URI, and query string.
Example
The following code sample illustrates how to use the <portlet:createWebflowURL> JSP tag:
<%@ taglib uri="portlet.tld" prefix="portlet" %>...
<center>
<font size="6" color="green">Portlet 2 - Page 1</font><BR>
<p>
<p>
Portlet Webflow Test:
<p>
<a href="<portlet:createWebflowURL event="switch"/>">Next Page</a>
<p>
</center>
<portlet:form>
The <portlet:form> tag is used in a JSP to dynamically generate an HTML form tag. This tag is not as sophisticated as the <portlet:validatedForm> tag, but is simpler. For more information about the <portlet:validatedForm> tag, refer to the next section.
<portlet:validatedForm>
The <portlet:validatedForm> tag is used to dynamically generate HTML forms that can be validated. When a Web site visitor enters invalid information, the visitor's input is preserved and redisplayed with an appropriate error message..
Example
The following code sample illustrates how to use the <portlet:validatedForm> JSP tag:
<%@ taglib uri="portlet.tld" prefix="portlet" %>
<%@ taglib uri="webflow.tld" prefix="webflow" %>
<center>
<% String validStyle="color: black; font-family: Arial"; %>
<% String invalidStyle="color: darkred; font-style: Arial"; %>
<%-- If there was an InvalidFormDataException thrown display the message --%>
<font size="3" color="darkred"><portlet:getException/></font>
<br>
<webflow:getProperty id="welcomeStr" property="WELCOME_STRING"
type="java.lang.String" scope="request" namespace="portlet3"/>
<% if (welcomeStr == null || welcomeStr.length() < 1)
{
%>
<portlet:validatedForm event="button.go" applyStyle="message" messageAlign="right"
validStyle="<%=validStyle%>" invalidStyle="<%=invalidStyle%>"
unspecifiedStyle="<%=validStyle%>" >
<p>
Welcome :
<webflow:text name="welcome" value="Hello" size="15" maxlength="30" /> <br>
<input type="submit" name="Submit"/> </portlet:validatedForm>
<br>
<%
}
else
{
%>
<font size="5" color="green"><%= welcomeStr %></font>
<%
}
%>
</center>
<p>
<portlet:createPortletEditURL>
The <portlet:createPortletEditURL> tag generates a webflow URL that represents editing a portlet.
Example
The following code sample illustrates how to use the <portlet:createPortletEditURL> JSP tag:
}
if (PortletRenderHelper.isEditable(request))
{
%>
<td width="1%" valign="middle"><a href="<portlet:createPortletEditURL httpsInd='http'/>">
<img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_edit.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Edit" align="absmiddle"></a></td>
<%
<portlet:createPortletUneditURL>
The <createPortletUneditURL> JSP Tag generates a webflow URL that represents leaving the edit URL and moving to another page.
<portlet:createPortletMinimizeURL>
The <portlet:createPortletMinimizeURL> JSP Tag generates a webflow URL that represents minimizing a portlet.
Example
The following code sample illustrates how to use the <portlet:createPortletMinimizeURL> JSP tag:
}
if (PortletRenderHelper.isMinimizable(request))
{
%>
<td width="1%" valign="middle"><a href="<portlet:createPortletMinimizeURL httpsInd='http'/>">
<img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_min.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Minimize" align="absmiddle"></a></td>
<%
<portlet:createPortletUnminimizeURL>
The <portlet:createPortletUnminimizeURL> tag generates a webflow URL that represents unminimizing a portlet.
Example
The following code sample illustrates how to use the <portlet:createPortletUnminimizeURL> JSP tag:
%>
<%-- Create a link to unminimize the portlet --%>
<td width="1%" valign="middle"><a href="<portlet:createPortletUnminimizeURL/>"><img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_unmin.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Restore" align="absmiddle"></a></td>
<portlet:createPortletMaximizeURL>
The <portlet:createPortletMaximizeURL> JSP Tag generates a webflow URL that represents maximizing a portlet.
Example
The following code sample illustrates how to use the <portlet:createPortletMaximizeURL> JSP tag:
<%
}
if (PortletRenderHelper.isMaximizable(request))
{
%>
<td width="1%" valign="middle">
<%-- Create the link to maximize the portlet --%>
<a href="<portlet:createPortletMaximizeURL httpsInd='http'/>"><img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_max.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Maximize" align="absmiddle"></a></td>
<%
<portlet:createPortletUnmaximizeURL>
The <portlet:createPortletUnmaximizeURL> JSP Tag generates a webflow URL that represents unmaximizing a portlet.
Example
The following code sample illustrates how to use the <portal:createPortletUnamximizeURL> JSP tag:
<%-- Create a link to unmaximize the portlet --%>
<td width="1%" valign="middle"><a href="<portlet:createPortletUnmaximizeURL/>"><img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_unmax.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Unmaximize"></a></td>
<portlet:createPortletFloatURL>
The <portlet:createPortletFloatURL> tag generates a webflow URL that represents creating a `floating' portlet, which is a portlet that appears in an independent window..
Example
The following code sample illustrates how to use the <portal:createPortletFloatURL> JSP tag:
<%
}
if (PortletRenderHelper.isFloatable(request))
{
url = portletState.getUrl(Portlet.URL_CONTENT);
%>
<util:validURL url="<%=url%>">
<% request.setAttribute( "fullscreenPortletURL", url); %>
<td width="1%" valign="middle"><a href="javascript:submitForm();"
onClick="openBrWindow('<portlet:createPortletFloatURL httpsInd='http'/>',
'<%= portletWindowName%>', 'scrollbars=yes,width=780,height=550'); return false;">
<img src="<webflow:createResourceURL resource='<%=imagesPath+"portlet_float.gif"%>'/>" hspace="1" vspace="2" border="0" alt="Float" align="absmiddle"></a></td>
</util:validURL>
<%
<portlet:getException>
The <portlet:getException> tag is used to retrieve the exception or message thrown by a webflow processor. This can be the message associated with a InvalidFormFieldException or ProcessingException. This tag can be inlined in which it calls getMessage() on the exception or return a scripting variable representing the exception itself.
Portal Tag Libraries
The following sections describe the portal tags and their attributes.
<portal:createWebflowURL>
The <portal:createWebflowURL> tag is used in a JSP to dynamically create a Webflow URL in a JSP. The Webflow URL may include the protocol, domain name, port, Web application URI, WebflowServlet URI, and query string.
<portal:form>
The <portal:form> tag is used in a JSP to dynamically generate an HTML form tag. This tag is not as sophisticated as the <portal:validatedForm> tag, but is simpler. For more information about the <portal:validatedForm> tag, refer to the next section.
<portal:validatedForm>
The <portal:validatedForm> tag is used to dynamically generate HTML forms that can be validated. When a Web site visitor enters invalid information, the visitor's input is preserved and redisplayed with an appropriate error message.
<portal:createPortalPageChangeURL>
The <portal:createPortalPageChangeURL> tag generates a webflow URL for a page change event.
Example
The following code sample illustrates how to use the <portal:createPortalPageChangeURL> JSP tag:
if (DISPLAY_TEXT_LINKS)
{
if (portalPageName.equals(selectedPage))
{
%>
<td class="tabselected" nowrap align="center">
<b>
<a href="<ptl:createPortalPageChangeURL pageName='<%= portalPageName %>'/>"><span class="tabselected"><%=portalPageName%></span></a></b></td>
<td class="tabselected" WIDTH="2"><b> </b></td>
<% }
else
{
%> <td class="tabunselected" nowrap align="center">
<b>
<a href="<ptl:createPortalPageChangeURL pageName='<%= portalPageName %>'/>"><span class="tabunselected"><%=portalPageName%></span></a></b></td>
<td class="tabunselected" WIDTH="2"><b> </b></td>
<% }
Utility Tag Libraries
The following section describes the utility tags and their attributes.
<utility:validURL>
Processes the body if the supplied url is not null and greater then 3 characters long.
Tag Attribute |
Required |
Type |
Description |
R/C |
---|---|---|---|---|
URL |
yes |
String |
The supplied URL that is processed if it is valid. |
R |
<utility:invalidURL>
The <utility:invalidURL> tag processes the body if the supplied url is null or less then 4 characters long.
Tag Attribute |
Required |
Type |
Description |
R/C |
---|---|---|---|---|
URL |
yes |
String |
The supplied URL. |
R |
Example
The following code sample illustrates how to use the <utility:invalidURL> as well as the <utility:validURL> JSP tag:
<%
// First try for an alternate header if one doesn't exist use the
// regular header
url = portletState.getUrl(Portlet.URL_ALTERNATE_HEADER);
debug.out("Alternate header: " + url);
%>
<util:invalidURL url="<%=url %>">
<% url = portletState.getUrl(Portlet.URL_HEADER); %>
</util:invalidURL>
<util:validURL url="<%=url %>">
<table cellpadding="4" cellspacing="0" width="100%" class="portletheader">
<tr>
<td width="100%">
<jsp:include page="<%=url%>"/>
</td>
</tr>
</table>
</util:validURL>
<%
![]() |
![]() |
![]() |
|
Copyright © 2002 BEA Systems, Inc. All rights reserved.
|