aspose file tools
The moose likes JSF and the fly likes Access to dataTable variable in Custom Component Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Access to dataTable variable in Custom Component" Watch "Access to dataTable variable in Custom Component" New topic
Author

Access to dataTable variable in Custom Component

Dale Chapman
Greenhorn

Joined: Oct 26, 2004
Posts: 2
Here is my situation:
We have written a custom component to do validation. This component includes a parameter called fieldLabel. This parameter is used to display the name of the field that validated incorrectly. So far, so good. The problem comes from using this validator within an <h ataTable> tag, with the value to be added to the fieldLabel being one of the properties of the dataTable variable. Whenever this occurs, the fieldLabel entry is evaluated to null when I create a ValueBinding on the expression.

--- JSP Snippet ---
<h ataTable>
<!-- unimportant stuff snipped -->
value="#{courseUI.course.offering}"
var="offering">

<!-- more snippage -->
<h:column>
<h:inputText value="#{offering.endDate}">
<f:convertDateTime pattern="#{commonProps.default_date_format}"/>
<ui:validateDate fieldLabel="#{offering.dateTypeString}"/>
</h:inputText>
</h:column>
<!-- more snippage -->

I know the above example is contrived, but it is the testcase that I wrote to recreate the problem. No matter what I do, I cannot get the #{offering.dateTypeString} to evaluate to anything other than null on the server.

--- Java code ---
// the following was the original code to obtain the value binding
public static String evaluator(String expression){
if (expression != null && UIComponentTag.isValueReference(expression)) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
return "" + app.createValueBinding(expression).getValue(context);
}
else return expression;
}

The above code works fine until you hit this situation. Any help would be greatly appreciated.

Thanks!!
Dale.


Any suggestions as to what I need to do to get a proper resolution of the variable?


Dale Chapman<br />Medavie Blue Cross
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access to dataTable variable in Custom Component
 
Similar Threads
Multiple JSF questions.
Input in a Nested table
How to select multiple rows in a datatable
Dynamic value for verbatim tag
JSF- Duplicate Component Id Exception