You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michal Straczynski (JIRA)" <de...@myfaces.apache.org> on 2005/12/28 10:59:01 UTC

[jira] Commented: (MYFACES-189) Valuebinding in Converter and Validator attributes do not work for dynamic beans

    [ http://issues.apache.org/jira/browse/MYFACES-189?page=comments#action_12361318 ] 

Michal Straczynski commented on MYFACES-189:
--------------------------------------------

Hello, I encountered a similar problem when trying to set validator's attribute as value binding to the property of managed bean with request scope. 

In the JSP code below "tableRecordsList" is the managed bean.

<h:inputText id="fieldValue_string" value="#{tableRecordsList.filter.fieldsValues[fieldName]}"			rendered="#{tableRecordsList.tableRecordMetadata.fieldsMetadata[fieldName].sqlTypeName == 'VARCHAR2'}" maxlength="#{tableRecordsList.tableRecordMetadata.fieldsMetadata[fieldName].length}">
    <f:validateLength maximum="#{tableRecordsList.tableRecordMetadata.fieldsMetadata[fieldName].length}" />
</h:inputText>

The validateLength tag causes:
 java.lang.NullPointerException
	at org.apache.myfaces.convert.ConverterUtils.convertToInt(ConverterUtils.java:51)
	at org.apache.myfaces.taglib.core.ValidateLengthTag.createValidator(ValidateLengthTag.java:81)
	at javax.faces.webapp.ValidatorTag.doStartTag(ValidatorTag.java:56)

The code works correctly when the validator tag is commented out. 

> Valuebinding in Converter and Validator attributes do not work for dynamic beans
> --------------------------------------------------------------------------------
>
>          Key: MYFACES-189
>          URL: http://issues.apache.org/jira/browse/MYFACES-189
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.0
>     Reporter: Mathias Broekelmann
>     Assignee: Mathias Broekelmann

>
> It is not possible to use a value binding which references a dynamically created bean (like the row in a datatable) in the converter and validator tags. These valuebindings are evaluated at creation time (doStartTag() method in the tag).
> Here is an example which will not work:
> <h:datatable value="#{data.rows}" var="row">
>   <h:column>
>     <h:outputText value="#{row.numberValue}">
>       <f:convertNumber minFractionDigits="#{row.numberScale}"/> <-- this will not work since row is not found.
>     </h:outputText>
>   </h:column>
> </h:datatable>
> I'will provide the patches if there will be an agreement that this should work. Since it is not a problem to evaluate the bindings at the right time (when converting or validating the value).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira