[
https://issues.apache.org/jira/browse/MYFACES-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13278975#comment-13278975
]
Mike Kienenberger edited comment on MYFACES-3547 at 5/18/12 5:23 PM:
---------------------------------------------------------------------
When I use myfaces-validators12-1.0.2.jar with myfacesi-1.2.9, I do not see the
re-evaluation behavior that you describe. Is this only valid for JSF 2.0? Or
does it depend on a specific optional jar file?
I do not use annotations -- is the use of annotations required to make this
happen?
I modified my class to extend
org.apache.myfaces.commons.validator.ValidatorBase. Previously it extended
org.apache.myfaces.validator.ValidatorBase, which to my quick glance used the
same pattern.
I copied amex code out of the credit card validator in commons just to be sure
and renamed it for my own method, also implementing the stateholder code.
Maybe there's something further I overlooked, but both the new ValidatorBase
code and the old ValidatorBase code both suffer from the same issue. The
setNoChangeValue() method is only called once from buildView. And because of
that, getValueExpression("noChangeValue") is never called since the "isSet"
flag is always true after that point.
SocialSecurityNumberValidator.setNoChangeValue(String) line: 111
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available
[native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 616
BeanPropertyTagRule$DynamicPropertyMetadata.applyMetadata(FaceletContext,
Object) line: 75
MetadataImpl.applyMetadata(FaceletContext, Object) line: 36
ValidateHandler(MetaTagHandler).setAttributes(FaceletContext, Object) line: 62
ValidateHandler.apply(FaceletContext, UIComponent) line: 98
[...]
FaceletViewHandler.buildView(FacesContext, UIViewRoot) line: 524
FaceletViewHandler.renderView(FacesContext, UIViewRoot) line: 567
public String getNoChangeValue()
{
if (noChangeValueSet)
{
return noChangeValueValue;
}
ValueExpression vb = getValueExpression("noChangeValue");
if (vb != null)
{
return (String) vb.getValue(getFacesContext().getELContext());
}
return null;
}
public void setNoChangeValue(String noChangeValue)
{
this.noChangeValue = noChangeValue;
this.noChangeValueSet = true;
}
was (Author: mkienenb):
When I use myfaces-validators12-1.0.2.jar with myfacesi-1.2.9, I do not see
the re-evaluation behavior that you describe. Is this only valid for JSF 2.0?
Or does it depend on a specific optional jar file?
I modified my class to extend
org.apache.myfaces.commons.validator.ValidatorBase. Previously it extended
org.apache.myfaces.validator.ValidatorBase, which to my quick glance used the
same pattern.
I copied amex code out of the credit card validator in commons just to be sure
and renamed it for my own method, also implementing the stateholder code.
Maybe there's something further I overlooked, but both the new ValidatorBase
code and the old ValidatorBase code both suffer from the same issue. The
setNoChangeValue() method is only called once from buildView. And because of
that, getValueExpression("noChangeValue") is never called since the "isSet"
flag is always true after that point.
SocialSecurityNumberValidator.setNoChangeValue(String) line: 111
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available
[native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 616
BeanPropertyTagRule$DynamicPropertyMetadata.applyMetadata(FaceletContext,
Object) line: 75
MetadataImpl.applyMetadata(FaceletContext, Object) line: 36
ValidateHandler(MetaTagHandler).setAttributes(FaceletContext, Object) line: 62
ValidateHandler.apply(FaceletContext, UIComponent) line: 98
[...]
FaceletViewHandler.buildView(FacesContext, UIViewRoot) line: 524
FaceletViewHandler.renderView(FacesContext, UIViewRoot) line: 567
public String getNoChangeValue()
{
if (noChangeValueSet)
{
return noChangeValueValue;
}
ValueExpression vb = getValueExpression("noChangeValue");
if (vb != null)
{
return (String) vb.getValue(getFacesContext().getELContext());
}
return null;
}
public void setNoChangeValue(String noChangeValue)
{
this.noChangeValue = noChangeValue;
this.noChangeValueSet = true;
}
> Can't use expression for validator attributes
> ---------------------------------------------
>
> Key: MYFACES-3547
> URL: https://issues.apache.org/jira/browse/MYFACES-3547
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.7
> Environment: validator ajax
> Reporter: Deryk Sinotte
> Priority: Minor
> Attachments: validator.zip
>
>
> Attaching a test case that shows a problem when using an expression for an
> attribute in a validator. We have markup that looks like this:
> <h:inputText id="ajaxMy"
> value="#{testBean.myNumber}">
> <f:validateLongRange minimum="1"
> maximum="#{testBean.maxValue}"/>
> <f:ajax execute="@this"
> render="@form"/>
> </h:inputText>
> When the value of the maximum attribute is modified via Ajax from another
> input field, the value of the bean is properly set but the validator doesn't
> resolve appear to resolve the expression at the right time and the result is
> that validation occurs against the "old" values.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira