Preview Mode JPS and PDK-Java Full Screen Mode PDK-Java

6-8 Oracle Fusion Middleware Developers Guide for Oracle Portal

6.1.2 Guidelines for Navigation within a Portlet

In some ways, navigation between different sections or pages of a single portlet is identical to navigation between standard Web pages. Users can submit forms and click links. In the case of typical, simple Web pages, both of these actions involve sending a message directly to the server responsible for rendering the new content, which is then returned to the client. In the case of portlets, which comprise only part of a page, the form submission or link rendered within the portlet does not directly target the portlet. It passes information to the portlet through the portal. If a link or form within a portlet does not refer back to the portal, then following that link takes the user away from the portal, which is not typically the desired behavior. The portlet developer does not need to know the detailed mechanics of how the parameters of a form or link get passed around between the user, portal, and portlet. However, they must understand that they cannot write links in a portlet the same way they do for typical, simple Web pages.

6.1.2.1 Types of Links for Portlets

A portlet may render links of four classes, as follows: ■ Intraportlet links require the portlet to be aware of the address of Oracle Portal because they actually refer to it in some way. ■ Portal links , like intraportlet links, must be aware of the address of Oracle Portal for the same reason. ■ External links make no reference to Oracle Portal and behave in portlets as they would do in a normal Web page. ■ InternalResource links , like external links, also make no reference to Oracle Portal. Figure 6–1 contains a summary of these link types. The arrows indicate how the links reference the resources to which they logically refer. Figure 6–1 Oracle Portal Link Types 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 }