I have an output text component with an ActionListener in a table. The
logger methods in the ActionListener gives me a null result. Can you
explain me, how I can access the value of the output text component with
id="colContent" without access an instanceVariable from the class?
<t:column style="vertical-align: top;">
<f:facet name="header">
<t:commandSortHeader styleClass="tableSorter"
immediate="false" columnName="type" arrow="true"
actionListener="#{packageLines.sortListener}">
<t:outputText id="colHeader"
value="#{message['packageLineOverview.tableColumn.lineName']}"></t:outputText>
</t:commandSortHeader>
</f:facet>
<t:outputText id="colContent"
value="#{packageLine.packageLineResource.name}"></t:outputText>
</t:column>
The following method shows the my ActionListener where I navigate from
the commandSortHeader to the outputText Component in the table.
public void sortListener(ActionEvent event) {
logger.info(event.getComponent());
HtmlCommandSortHeader header = (HtmlCommandSortHeader)
event.getComponent();
List list = header.getParent().getChildren();
UIComponent component = header.getParent().findComponent("colContent");
ValueBinding binding = component.getValueBinding("value");
logger.info("expressionString: "+binding.getExpressionString());
if (component instanceof UIOutput) {
UIOutput output = (UIOutput) component;
logger.info("localValue: "+output.getLocalValue());
logger.info("value: "+output.getValue());
}
}
The output is for the localValue and value null:
PackageLineList sortListener -
[EMAIL PROTECTED]
PackageLineList sortListener - expressionString:
#{packageLine.packageLineResource.name}
PackageLineList sortListener - localValue: null
PackageLineList sortListener - value: null