Trying ExtVal with JSF 1.1, I came across following 'issue'. I was playing with the OutputLabel example (see http://os890.googlecode.com/svn/trunk/java/web/jsf/extval/examples/advanced/demo_107) to see how the 'lack' of label attribute in JSF 1.1 can be solved by the ExtVal code. It works very good but then I came across the problem of a conversion validation problem. What I mean is the following thing: When we have a field bound to a 'numeric' property (like Integer) the conversion fails and isn't catched by the ExtVal code.
The conversion problem results in a message where the field Id is displayed in the message, and not the label which is in front of it. I traced where the Exception passes through the ExtVal code and found the ExtValRendererProxy where the Conversion Exception is catched but not handled. See public Object getConvertedValue(FacesContext facesContext, > UIComponent uiComponent, Object o) throws ConverterException { > ... > try { > > entry.setConvertedValue(wrapped.getConvertedValue(facesContext, > uiComponent, o)); > } catch ... > where the getConvertedValue is called from the 'original' renderer. The ExtVal code isn't dealing with the conversion 'problem' but just does a 'reset component proxy mapping'. The conversion isn't really the main core of the ExtVal code and focuses on the real validation issues which is great. The conversion exception can be easily catched and maybe send to the 'Interceptors' that are also executed when there is a validation error. Doing this, the message can be adjusted and the field id can be replaced by the label. code could be changed to the following lines > try { > > entry.setConvertedValue(wrapped.getConvertedValue(facesContext, > uiComponent, o)); > // Start of added code > } catch (ConverterException ex) { > ValidatorException validatorException = new > ValidatorException( > ex.getFacesMessage()); > ExtValUtils.executeAfterThrowingInterceptors(uiComponent, > null, > o, validatorException, null); > resetComponentProxyMapping(); > throw ex; > // end of added code > } catch (RuntimeException r) { > resetComponentProxyMapping(); > throw r; > }* > * It isn't an ideal situation since we have to pass some null parameters to the method (for the MetaDataEntry en ValidationStrategy). So my questions are: * Do I miss something and is it possible to show the outputLabel value in case of a conversion error with JSF 1.1 and ExtVal? * The 'problem' occurs only with JSF 1.1, with 1.2 (and 2.0 of course) there is no problem when we use the label attribute. So is there a need for some specific code (for JSF 1.1 only) when newer and better versions are available? * The suggested solutions is not elegant and needs changes to the core of ExtVal. The use of the labelRecorder is given as an example of some practical usage of ExtVal and thus changes to the core are maybe to intrusive for this little problem. * Should the implementation of the ExtValRendererProxy be changed so that an extended class can be made easier, and thus allows the users of the ExtVal code solve the problem when they feel the need for it? For instance there is a protected empty method (processException) that subclasses can override do some specific handling with the caught exception. Just my thoughts, any comment and suggestions are welcome. I have also a small project that can be used to play a little more with the conversion issue. regards Rudy De Busscher