Links in a portal page typically need to pass information. There are several techniques you can use in constructing a link, including:
paf:encodeURL
JSP tagPortalServletResponse.encodePortalUrl
methodGearServletResponse.encodeGearUrl
method
The paf:encodeURL
tag encodes a portal URL, encoding session ID and portal-specific parameters. The tag takes the following parameters:
| This required parameter stores the resultant encoded portal URL. |
| The URL to encode. Defaults to the requested URI if not specified. Optional. |
| An object representing the portal in a particular state. Defaults to the currently rendering portal state if not specified. Optional. |
| An object representing a particular state of the gear and portal. Optional. |
The following example illustrates the use of this tag to encode a URL that puts the portal in full display mode.
<% fullPortalContext = new PortalContextImpl(portalContext); fullPortalContext.setDisplayMode(DisplayMode.FULL); %> <paf:encodeURL id="fullURL" portalContext="<%= fullPortalContext %>"> <a href="<%= fullURL %>">full</a> </paf:encodeURL>
The example below shows how one might create a link to a gear rendering in “help” mode, using the GearServletResponse.encodeGearUrl
method.
<% GearContext currentGearContext = (GearContext) request.getAttribute(Attribute.GEARSERVLETREQUEST); GearContextImpl gearContext = new GearContextImpl(currentGearContext); gearContext.setGearMode(GearMode.HELP); %> ... ... <a href="<%= gearServletResponse.encodeGearURL(myURL,gearContext) %>">help</a>