| bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
|||||||
| e-docs > WebLogic Platform > WebLogic Portal > JavaServer Page Guide > Portal and Portlet Management JSP Tags |
|
JavaServer Page Guide
|
Portal and Portlet Management JSP Tags
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:
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. Table 2-1 describes the <portlet:createWebflowURL> tag attributes.
Example
Listing 2-1 illustrates how to use the <portlet:createWebflowURL> JSP tag.
Listing 2-1 Using <portlet:createWebflow>
<%@ 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. See <portlet:validatedForm> tag for more information. Table 2-2 describes the <portlet:form> tag attributes.
<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. Table 2-3 describes the <portlet:ValidatedForm> tag attributes.
Example
The following code sample illustrates how to use the <portlet:validatedForm> JSP tag:
Listing 2-2 Using <portlet:validatedForm>
<%@ 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
Listing 2-3 illustrates how to use the <portlet:createPortletEditURL> JSP tag:
Listing 2-3 Using <portlet:createPortletEditURL>
}
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. Table 2-5 describes the <portlet:createPortletUneditURL> tag attributes.
<portlet:createPortletMinimizeURL>
The <portlet:createPortletMinimizeURL> JSP tag generates a webflow URL that represents minimizing a portlet. Table 2-6 describes the <portlet:createPortletMinimizeURL> tag attributes.
Example
Listing 2-4 illustrates how to use the <portlet:createPortletMinimizeURL> JSP tag:
Listing 2-4 Using <portlet:createPortletMinimizeURL>
}
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. Table 2-7 describes the <portlet:createPortletUnminimizeURL> tag attributes.
Example
Listing 2-5 illustrates how to use the <portlet:createPortletUnminimizeURL> JSP tag:
Listing 2-5 Using <portlet:createPortletUnminimizeURL>
<%-- 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. Table 2-8 describes the <portlet:createPortletMaximizeURL> tag attributes.