Link Mode PDK-Java Portlet defaults

Creating Java Portlets 6-9

6.1.2.1.1 Intraportlet Links Intraportlet links go to different sections or pages within a

given portlet. Strictly speaking, they refer to the page containing the portlet, but they contain parameters that cause the portlet to render a different section or page within that page when it is requested by the user. As a direct consequence, a portlet cannot expect to render links to different sections or pages of itself using relative links or absolute links based on its own server context. Intraportlet link are useful for intraportlet navigation, either as links or form submission targets.

6.1.2.1.2 Portal Links Portal links refer to significant pages within Oracle Portal, such

as the users home page.

6.1.2.1.3 External Links External links refer neither to the portlet through a page nor

to any part of the portal. If selected, these links take the user away from the portal, for example, www.oracle.com.

6.1.2.1.4 InternalResource Links InternalResource links refer to internal to the portlet

resources. Sometimes they are exclusively used internally during portlet rendering, for example as a server side include. On other occasions, they may be used externally to reference portlet resources like images. In this latter case, you can use the PDK-Java constructResourceURL method in the UrlUtils class to retrieve images from behind a firewall using resource proxy. For example, lottery.jsp of the lottery sample, which is available with PDK-Java, contains resource proxy requests for images. page contentType=texthtml;charset=UTF-8 page session=false import=oracle.portal.provider.v2.render. page import=oracle.portal.provider.v2.render.http.HttpPortletRendererUtil page import=oracle.portal.provider.v2.url.UrlUtils page import=oracle.portal.sample.v2.devguide.lottery. LottoPicker picker = new LottoPicker; picker.setIdentityrequest.getRemoteAddr ; PortletRenderRequest portletRequest = PortletRenderRequest request.getAttributeoracle.portal.PortletRenderRequest; String name = portletRequest.getUser.getName; P class=PortletHeading1 ALIGN=CENTERHi = name , Your Specially PickedP P ALIGN=CENTERIMG SRC== UrlUtils.constructResourceURLportletRequest, HttpPortletRendererUtil.absoluteLinkrequest, imageswinningnumbers.gif WIDTH=450 HEIGHT=69 ALIGN=BOTTOM BORDER=0P P P ALIGN=CENTER TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=0 TR int [] picks = picker.getPicks; for int i = 0; i picks.length; i++ { TD IMG SRC== UrlUtils.constructResourceURLportletRequest, HttpPortletRendererUtil.absoluteLinkrequest, imagesball + picks[i] .gif WIDTH=68 HEIGHT=76 ALIGN=BOTTOM BORDER=0 TD } 6-10 Oracle Fusion Middleware Developers Guide for Oracle Portal These calls cause the Parallel Page Engine to make the request to the resource and return it to the browser. For session-based providers, any cookies returned from the original initSession call to the provider are sent with the request back to the provider to maintain the right session context.

6.1.3 Guidelines for JavaScript

You may find the use of JavaScript useful within a portlet, but bear in mind the following guidelines within your portlets: ■ You should never use JavaScript to redirect the page in which the portlet is rendered. If you need to direct users elsewhere, you should do so in your portlet action handling code or open a new window in the browser. ■ Ensure that identifiers in your JavaScript are qualified. By qualifying your identifiers, you ensure that they are unique and do not clash with any other JavaScript on the page.

6.1.4 Guidelines for Mobile Portlets

Oracle Portal is capable of rendering its pages for both HTML and non-HTML mobile devices. When rendering for a mobile device, Oracle Portal requires portlets to generate content in a universal markup language called OracleAS Wireless XML. Many portlets, known as desktop portlets, generate only HTML responses and as such can only render themselves in standard HTML browsers. Some portlets, known as mobile portlets, generate only OracleAS Wireless XML responses. These portlets can render themselves on any device, including standard HTML browsers. Many portlets, though, take a hybrid approach that renders either HTML or OracleAS Wireless XML depending on the environment. These hybrid portlets can render themselves on any device, but they render best on standard HTML browsers. Although OracleAS Wireless XML is sufficient for HTML responses, it is not as expressive as HTML. Since portlets running in both a desktop and mobile environment are typically accessed using the desktop, developers commonly choose to create hybrid portlets that can provide the best possible rendition in the desktop environment. When building mobile portlets, you should adhere to the following guidelines: ■ Section 6.1.4.1, Declare Capabilities ■ Section 6.1.4.2, Declare a Short Title ■ Section 6.1.4.3, Implement Personalization of the Short Title ■ Section 6.1.4.4, Implement Link Mode ■ Section 6.1.4.5, Heed Device Information ■ Section 6.1.4.6, Tailor Personalization Pages For information on how to build mobile-enabled portlets, refer to Section 7.2.10, Enhancing Portlets for Mobile Devices .

6.1.4.1 Declare Capabilities

To properly manage portlets, Oracle Portal must know the set of content types a portlet generates. Oracle Portal uses this information in the following ways: ■ To restrict the Portlet Repository view in the Add Portlet dialog. Only those portlets capable of being rendered on the targeted page will appear in the Add Portlet dialog. For example, when a user invokes the Add Portlet dialog from a