Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Access to dataTable variable in Custom Component  RSS feed

Dale Chapman
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 -->

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


Any suggestions as to what I need to do to get a proper resolution of the variable?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!