JDEV ADF af:goLink: Build Destination URL with Parameter Value from af:inputField

A discussion on the OTN JDeveloper forum asked for an af:goLink which should not be static but use values from form fields as parameters for the link.
I set up a simple workspace with JDev to show how to do this. The technique can be used in JDeveloper 11.1.1.x.0 too, only the provided workspace won’t work. To download the workspace see the link at the end of the post.
The workspace uses the HR schema to get access to the employees table and show an employee in a from on the only page.

Running App

Running App

The image shows the running application. You see the form showing an employee, the navigation buttons and the big af:goLink. A click on the link opens a new page with Google and searches for the last name of the employee. When you navigate over the employees the link changes its parameters to pass the last name of the selected employee in the form. To make it more interesting the last name filed is set to autoSubmit so you can search for a changed name without committing the recored first. The af:goLink uses an EL in the destination property to point to a method in a request scope bean which builds the final url with the attached parameter. The parameter is the current value of the last name attribute from the bindings.
Sample 1

Sample 1

Sample 2

Sample 2

Sample 3

Sample 3

Here is the code for the last name input field and the code in a request scope bean to calculate the destination for the af:goLink:

<af:inputText value="#{bindings.LastName.inputValue}"
                                      shortDesc="#{bindings.LastName.hints.tooltip}" id="it3"
                            <f:validator binding="#{bindings.LastName.validator}"/>
                        <af:goLink text="LinkWithParams" id="gl1" targetFrame="_blank"
import oracle.adf.model.BindingContext;
import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;

public class LinkWPBean {
    public LinkWPBean() {

    public String getLinkWithParams() {
        // get the binding container
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

        // get an ADF attributevalue from the ADF page definitions
        AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("LastName");
        String valLastName = (String) attr.getInputValue();

        String base = "http://www.google.com/#sclient=psy&q="+valLastName;
        return base;

You can download the work space here: Workspace BlogLinkWithParams.zip You have to rename the file to BlogLinkWithParams.zip as the file contains a simple zip file.

4 thoughts on “JDEV ADF af:goLink: Build Destination URL with Parameter Value from af:inputField

  1. Hi can I do the following?
    Click on the goLink (I put it inside a tree) and show the page but on a panel without redirecting to a page but just updating the panel? or some other container?

Leave a Reply to Abhinandan Panda Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.