Changing the target of a JSF link

You can change the target attribute of a JSF link from a pageHandler. For example, you can set the link's target attribute to _blank to make that link open in a new browser window.

This task has the following prerequisites. For more information, see Accessing a JSF component from a pageHandler.
Follow these steps to change the target attribute of a JSF link from a pageHandler:
  1. On a blank line inside a function in the pageHandler, press Ctrl+Shift+Z. The EGL Source Assistant window opens, displaying the JSF components on the page.
  2. In the EGL Source Assistant window, select the JSF component you want to access.
  3. Click OK.
    The EGL source assistant adds two lines of EGL code to the pageHandler. The first line defines an EGL variable of the type that matches the JSF link that you selected. The second line associates that variable with the JSF link. For example, the code might look like this:
    linkEx1 HtmlOutputLink;
    linkEx1 = myViewRoot.findComponent("form1:linkEx1");
  4. Using the EGL variable created by the source assistant, change the target of the link with the setTarget() function. For example, to make the link open in a new window, add this code:
    linkEx1.setTarget("_blank");

Related concepts
JSF component tree
viewRootVar property

Related tasks
Adding JSF component interface support to an EGL Web project
Accessing a JSF component from a pageHandler
Changing the style class of a JSF component
Changing the style of a JSF component
Enabling or disabling JSF components
Setting the size of a JSF image
Setting event handlers for a JSF component
Setting JSF data table properties

Related reference
Component tree access parts

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.