Get Content

Within a JSF Widget Library (JWL) panel tag, this tag defines alternative content for the panel which can be asynchronously retrieved after the page has been loaded into the browser. The tag is used to dynamically modify the content of a Web page (without replacing/redrawing it) based on actions taken by a user. For example, as a result of answering a question, content appropriate to the answer supplied can be plugged into the page.

Whenever a JWL get action is run against the component parent panel (for example, as the result of a button click), the client requests the alternative content for the panel and if it is available, it replaces the existing content of the panel with the new content. The page containing the panel is not replaced by the get, instead, this tag allows part of the page to be replaced. The revised content for the page is retrieved from the same JSP that the original content came from. Both the server lifecycle copy of the page and the client-side page are kept in sync. The new page content is retrieved using a get HTTP request operation (as opposed to ajaxRefreshSubmit which does the same operation but using a post HTTP request. As a get is performed, any values that are needed on the server so that the content can be correctly computed are added as parameters to the URL.

Note: If you are using a previous version of this product, when adding the ajaxRefreshRequest and ajaxRefreshSubmit tags to the JSP, the following must be added to the Faces configuration file (typically faces-config.xml):

<factory>
        <faces-context-factory>
            com.ibm.faces.context.AjaxFacesContextFactory
        </faces-context-factory>
        <render-kit-factory>
            com.ibm.faces.renderkit.AjaxRenderKitFactory
        </render-kit-factory>
    </factory>

Note: The Data Tree control's <odc:treeNodeAttr> tag uses different values for its className attribute when bound to SDO data versus WDO data. After migrating a project from a server that uses WDO (such as WebSphere® Application Server 5.1) to one that uses SDO (such as WAS 6.1), the easiest way to fix this is to delete and recreate any Data Tree controls.

Restriction: To link to a Faces JSP file from a HTML file change the referenced filename from <filename>.jsp to <filename>.faces in the HTML page. Do not rename the actual Faces JSP file extension. When you change the referenced link to a .faces extension in the HTML file, Links Builder will not work.

To use this tag:

  1. Put a panel in the page whose content will be dynamically computed and refreshed. Add the hx:ajaxRefreshRequest tag to the panel:

    <h:panelGroup id="panel1">
            <hx:ajaxRefreshRequest onerror="return doError(this, event);"/>
        </h:panelGroup>

  2. Within the panel, put tags which are either rendered based on a conditional expression or whose value is an expression (or has some other aspect that varies based on an expression). For example:

    <h:outputText id="otext2" escape="false"
    rendered="#{param.text1 != null}" value="You typed:<b> #{param.text1}</b>"/>

  3. Make sure that the values used in the conditional expressions are added as parameters of the behavior. When the request is made, the values will be sent to the server where they are available as parameters in the expressions. For example:

    <hx:ajaxRefreshRequest onerror="return doError(this, event);"
    params="text1"/>

  4. Identify what action a user takes that causes new content to be put in the page and add a behavior for that tag/event which invokes the request. For example:

    <hx:commandExButton type="button" value="Enter"
    id="button1">
            <hx:behavior event="onclick" behaviorAction="get;stop"
    targetAction="panel1"/>
        </hx:commandExButton>

 

Allowed as Child Tag

The tag may be used as a child of the following tags:

 

Allowed Contents

The tag rebuilds the content of a panel tag (allowed tags listed above). A panel that is being rebuilt may include any JSF tags except the following:

 

Properties and All Attributes views

The Properties view for a component shows the most common set of attributes you can set on a component, and, depending on the component, you might also see options for adding controls, actions, or other components. To open the Properties view, click

Window | Show View | Properties.

The common attributes for the Get Content component are listed in the table below.

The All Attributes view shows a table of all the attributes you can set on a component, which includes those attributes you can access from the Properties view. To switch to the All Attributes view, click the

All Attributes icon in the upper right corner of the Properties view.

Table 1. Get Content component attributes

Attribute name

Description

binding

An expression that binds the component's instance (usually a user interface component) to a bean property (usually in the backing file).

id

Assigns a name to a component. Should be a unique name within a JSP.

inProgress

Attribute is not yet available.

rendered

Can be set to true or false:

  • false - Component will not be rendered to the browser at runtime.

  • true - Component will get rendered. This is the default value.

params

The value of these tags will be retrieved and appended as params to the URL used to get the new content. The name of the param will be the simple ID provided. For example, if the ID is "text1", the param will be named "text1" (not "form1:text1").

target

Assigns the target frame within a frameset that a page should be loaded into when the hyperlink is clicked:

  • New Window

  • Same Frame

  • Parent Frame

  • Full Screen

title

Specifies the title text, shown in browser as a tooltip at runtime. Used by a browser as the alternative text of a component if the alternative text is not specified.

oncomplete

If a request succeeds, after the content of the panel is replaced, this JavaScriptâ„¢ is executed. The function has no meaningful arguments.

onerror

If provided, a JavaScript function to be executed when onblur fires and the field value fails validation. The function is executed before the action is executed. If the function returns false, the action is not run and processing of the event is halted (if the DOM halts it).

onstart

When the behavior starts executing, this JavaScript function is executed. It has no meaningful arguments. If it returns false execution is halted. This function can be used (in conjunction with oncomplete to customize what is displayed while the request is in progress.