myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard <gerhard.petra...@gmail.com>
Subject Re: [ExtVal] Trouble with ExtValElResolver and a Map<Object,Object>
Date Tue, 17 Aug 2010 11:17:01 GMT
hi cedric,

you are right - however, we need a property name to identify the target.
i'll change that - as soon as there is no property name, we don't continue
with the validation process and log a warning.

as alternative you could refactor the expression so that the map-trick is
not at the >end< of the expression.

the issue happens quite early - so everything which is in place for skipping
the validation process won't help.
(you could also customize extval to change the default behavior)

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2010/8/17 C├ędric Durmont <cdurmont@gmail.com>

> Hello,
>
> I'm new to ExtVal, so it's possible I'm missing something, but I have
> troubles with a page containing this :
>
> [...]
> <tr:selectOneChoice value="#{someBean.status[member]}">
> [...]
>
> Where status is declared as a Map (actually what I do here is the
> el-map trick to call a method with an argument), and member is a POJO.
> Works fine without ExtVal, but when I add ExtVal, I get an exception
> when validating the page :
>
> java.lang.IllegalStateException: error at binding:
> #{beanBenef.beneficiaire.famille.statut[membre]} -- an el-resolver
> error occurred! maybe you used an invalid binding. otherwise: please
> report the issue, deactivate the el-resovler of extval via web.xml
> context-param:
> org.apache.myfaces.extensions.validator.DEACTIVATE_EL_RESOLVER
> and test again.
>        at
> org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getPropertyDetailsOfValueBinding(DefaultELHelper.java:182)
>        at
> org.apache.myfaces.extensions.validator.crossval.recorder.CrossValidationUserInputRecorder.recordUserInput(CrossValidationUserInputRecorder.java:56)
>        at
> org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.beforeGetConvertedValue(AbstractValidationInterceptor.java:114)
>        at
> org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.getConvertedValue(ExtValRendererWrapper.java:468)
>        at
> org.apache.myfaces.trinidad.component.UIXEditableValue.getConvertedValue(UIXEditableValue.java:422)
> [...]
> Caused by: java.lang.ClassCastException:
> sap.metier.utilisateur.Beneficiaire cannot be cast to java.lang.String
>        at
> org.apache.myfaces.extensions.validator.core.el.ExtValELResolver.setValue(ExtValELResolver.java:181)
>        at com.sun.el.parser.AstValue.setValue(AstValue.java:167)
>        at
> com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:269)
>        at
> com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
>        at
> org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getPropertyDetailsOfValueBinding(DefaultELHelper.java:178)
>        ... 80 more
>
> The exception is thrown here (ExtValELResolver.java:181) :
>    public void setValue(ELContext elContext, Object o, Object o1, Object
> o2)
>    {
>        expression += "." + o1;
>        property = (String)o1;  // <== HERE
> [..]
> "o" is my Map, o1 is the POJO, which is definitely not castable to a String
> !
>
>
> The message says I can disable the resolver, which removes the error.
> But then I have other messages from ELHelpher trying to resolve
> complex EL such as #{bean.someMap[ value != null ? value :
> 'default']}. The message says that :'default' is not a valid EL
> operator...
>
>
> Is there a way to circumvent this ? I definitely need a Map with a
> non-String Object as key ! Is it possible to prevent ExtVal from
> analysing one EL, or one page ?
>
> Regards,
> Cedric Durmont
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message