| 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
|
 |
 |
|
|
subject: Access to dataTable variable in Custom Component
|
|
|