Portal, Express Beta Version 6.1
Operating systems: i5/OS, Linux,Windows |
URLs encode navigational state information about WebSphere Portal Express (for example, the user's currently selected page) and about the portlets on a page (for example, the window state of the portlet) in a serialized form. Encoding navigational state information in the URL is used by the portal server to support use of the browser's back button.
You can create URLs to the following target resources.
Quick Links can also be used to access major areas of the site. Quick Links are also accessible from any location within the site, and you can customize them. Quick Links are displayed at the bottom of the site and can be customized as well as provide one-click access to major areas of the site. Refer to the Adding a Quick Link section of this topic for more information.
<portal-navigation:urlGeneration contentNode="ibm.portal.WebSphere Portal.Welcome" layoutNode="welcome.bookmarks" portletWindowState="Maximized" accessControlCheck="NoCheck"> <portal-navigation:urlParam name="<%= month %>" value="August" type="render" /> <portal-navigation:urlParam name="<%= day %>" value="Monday" type="render" /> <portal-navigation:urlParam name="<%= amount %>" value="<%= ACCOUNT_BALANCE %>" type="render" /> <a href="<% wpsURL.write(out); %>" class="wpsLinkBarLink"> <portal-fmt:text key="link.bookmarkstitle" bundle="nls.myproperties"/> </a> </portal-navigation:urlGeneration>To target the action phase on a standard portlet, you need to also include the portletParameterType attribute on the <portal-navigation:urlGeneration/> tag, as in the following example.
<portal-navigation:urlGeneration contentNode="sample.page" layoutNode="sample.portlet" portletParameterType="action"> <portal-navigation:urlParam name="key" value="value"/> <a href="<% wpsURL.write(out); %>"> // simple action with param </a> </portal-navigation:urlGeneration>Note: To target the action phase of an IBM portlet, use the actionName attribute, which is described in <portal-navigation/> tags.
The following example is used in the drop-down list in the toolbar to generate a URL to the Organize Favorites portlet. The noCheck value indicates that the user's access control is not checked prior to generating the tag content.
<portal-navigation:urlGeneration contentNode="wps.Organize Favorites" portletWindowState="Normal" pacCheck="NoCheck"> <option value='<% wpsURL.write(out); %>' > <portal-fmt:text key='link.favorites.orgainize' bundle='nls.engine'/> </portal-navigation:urlGeneration>
The following steps show how to add a custom page link in one of the theme JSPs. The link opens a page using its custom unique name. The steps use a page with the custom unique name of yourCo.MyAccountsPage.
<portal-logic:if loggedIn="yes" portletSolo="no"> <portal-navigation:urlGeneration contentNode="yourCo.MyAccountsPage"> <td class="wpsToolBar" valign="middle" align="<%=bidiAlignRight%>" nowrap> <a href="<% wpsURL.write(out); %>" class="wpsToolBarLink"> My Account </a> </td> </portal-navigation:urlGeneration> </portal-logic:if>
Including navigational state information in the URL results in longer URLs. A large number of URLs on a page, from the themes, skins, and portlets, can make the markup for the page unwieldy and difficult to manage. Generating relative URLs can help manage the size of URLs and overall markup on a page. This section describes how relative URLs are generated and considerations for applying them.
URLs can take three forms:
Details on the difference between relative and absolute URL formats can be found in RFC1738.
Instead of encoding the complete navigational state into every URL on a page, WebSphere Portal Express provides ways for you to encode only the difference (delta) of the state that is represented by the URL with respect to the state of the request that generated the markup. The state of the current request is represented (in the HTML case) by the HTML <base/> tag in the head area of the HTML response. An equivalent tag exists in XHTML and CHTML. Overall, relative URLs are preferable because they are smaller and require less server resources to generate, giving better performance.
There are two ways to control the generation of relative URLs as opposed to server-relative URLs. It can be controlled through a global setting which affects all URLs generated by WebSphere Portal Express, or through an optional attribute on the <portal-navigation:urlGeneration/> tag, which overrides the global setting. This section describes those settings and the general requirements which determine when WebSphere Portal Express can generate relative URLs.
The following general prerequisites must be met in order for WebSphere Portal Express to generate a relative URL:
The following settings allow the fine grained control of relative URL generation.
In some cases the generation of URLs that are relative to a base URL as specified in the HTML header can lead to incompatibilities with existing code that cannot handle this URL type.
Code should not bookmark URLs on the server side to represent bookmarks but rather the payload of these URLs only. For example, if server side bookmarks to pages need to be set, only the object IDs or the unique names of the target pages should be stored persistently. At invocation time, a fresh URL can be generated from this data that is then valid in the context of the rendering page.
Code should not pass the value returned by a <portal-navigation:urlGeneration/> tag as a parameter to a JavaScript method, but rather the href attribute of the respective link. For example, assume that a JavaScript method doSth(url) should be called if a link is clicked and that the url has been generated by <portal-navigation:urlGeneration/>. The following syntax works with all types of URLs:
<a href="url" onClick="doSth(this.href)">some text</a>.
Quick Links are used to access major areas of the site. Quick Links are accessible from any location within the site and you can customize them. Quick Links are displayed at the bottom of the site and can be customized as well as provide one-click access to major areas of the site. To add a Quick Link to your page, use the following instructions: