dev@woodstock.java.net

Re: Hyperlink in a table component

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Mon, 25 Feb 2008 15:37:54 -0500

graham townsend wrote:
> I have a Woodstock table component and the first column should be a
> hyperlink. However, I am unable to call the backing bean action method
> on it and am stumped.
>
> The faces-config is fine because If I move the hyperlink outside of
> the table it works...any idea what I am missing here? Thx!
>
> <webuijsf:table augmentTitle="false"
> binding="#{Search.searchResultsTable}" id="searchResultsTable">
>
> <webuijsf:tableRowGroup binding="#{Search.tableRo
> wGroup1}" id="tableRowGroup1"
> rows="10"
> sourceData="#{Search.searchResultCollection}" sourceVar="currentRow">
>
> <webuijsf:tableColumn
> binding="#{Search.columnSubmissionType}" headerText="Call Action"
> id="columnSubType">
> <webuijsf:hyperlink
> actionExpression="#{fragments$search$Search.accessAction}"
> binding="#{Search.hyperlink1}" id="hyperlink1"
> text="#{currentRow.value['subType']}"/>
>
> </webuijsf:tableColumn>
>
> </webuijsf:tableRowGroup>
> </webuijsf:table>

Please see the TLD docs below for tableRowGroup.

    http://webdev2.sun.com/woodstock-tlddocs

In the TLD docs you will find a section, labeled "Life Cycle". This
should explain how the table works in the JSF life cycle. I've included
the section below. Most likely, you have not provided the DataProvider
correctly during the apply request values (i.e., decode) phase.


        Life Cycle

The |sourceData| property of tableRowGroup is invoked at least twice
during the JavaServer Faces life cycle. The |sourceData| is invoked once
during one of the Apply Request Values, Process Validations, or Update
Model Values phases, and once during the Render Response phase. In order
to process the previously displayed children during the Apply Request
Values, Process Validations, or Update Model Values phases, the table
must use the same DataProvider that was used to render the previous
page. For example, suppose that sorting, filtering, and pagination were
applied on the previous page, and rows 10-20 of 1000 were currently
displayed. You want to update only the currently displayed components,
rows 10-20. To do this, you must not update the DataProvider until the
Invoke Application phase or Render Response phases, when it is safe to
render new data.

Note that if the underlying DataProvider has changed in any way,
processing of the previously displayed children might not be possible
during the Apply Request Values, Process Validations, or Update Model
Values phases. In addition, if the DataProvider is null or empty, no
children will be processed and their |processDecodes()|,
|processValidators()|, and |processUpdates()| methods will not be
invoked. If a component has not been decoded (in the Apply Request
Values phase), action events might not be received and component
properties such as hyperlink query parameters cannot be retrieved.
Also, if a component has not been updated (in the Update Model Values
phase), submitted values cannot be retrieved for checkboxes, radio
buttons, etc.

When obtaining data is expensive, consider caching the DataProvider. A
cached DataProvider persists across requests if the backing bean uses
session scope, or if the application uses server-side state saving and
the |TableRowGroup.setSourceData| method is set. Note that a phase
listener may be used to initialize the DataProvider during the Invoke
Application Phase. However, when the underlying DataProvider has changed
in any way, UI guidelines recommend that pagination is reset to the
first page. You can use the tableRowGroup component's |setFirst()|
method to set the first row to be displayed.