[
https://issues.apache.org/jira/browse/EXTVAL-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13184888#comment-13184888
]
Igor Guimaraes commented on EXTVAL-140:
---------------------------------------
Rudy,
I fixed the bug, changed the way of get the facesBean. I modified the method
addMetaDataToContext of class DefaultELHelper, for get FacesBean Object using a
method "getFacesBean" provided by Trinidad (using reflection), on class
UIXComponentBase, ancestor of my JSF component .
If you use a Trinidad in integrator ExtVal (myfaces-extval-trinidad-support),
it would be interesting to use the API to retrieve this data.
By now, i will use a modify version of 2.0.6-SNAPSHOT with my solution, and
keep waiting a version with this issue fixed.
Thank you.
Igor GuimarĂ£es
public static void addMetaDataToContext(
UIComponent component, PropertyDetails propertyDetails, boolean
processModelValidation)
{
String[] key = propertyDetails.getKey().split("\\.");
Object firstBean = null;
try
{
//elHelper.getBean(key[0]);
firstBean = getFacesBean(component.getClass(), component);
}
catch (Exception e)
{
e.printStackTrace();
}
if(firstBean == null)
{
firstBean = new Object();
}
List<Class> foundGroupsForPropertyValidation = new ArrayList<Class>();
List<Class> restrictedGroupsForPropertyValidation = new
ArrayList<Class>();
List<ModelValidationEntry> modelValidationEntryList = new
ArrayList<ModelValidationEntry>();
List<Class> restrictedGroupsForModelValidation = new ArrayList<Class>();
String activeViewId =
FacesContext.getCurrentInstance().getViewRoot().getViewId();
bvmi.extractExtValBeanValidationMetaData(propertyDetails,
processModelValidation,
key,
firstBean,
foundGroupsForPropertyValidation,
restrictedGroupsForPropertyValidation,
modelValidationEntryList,
restrictedGroupsForModelValidation,
activeViewId);
bvmi.processExtValBeanValidationMetaData(component,
propertyDetails,
foundGroupsForPropertyValidation,
restrictedGroupsForPropertyValidation,
modelValidationEntryList,
restrictedGroupsForModelValidation,
activeViewId);
}
public static Object getFacesBean(Class clazz, UIComponent component)
throws Exception
{
if(clazz.getMethod("getFacesBean") != null)
{
return clazz.getMethod("getFacesBean").invoke(component);
}
else
{
return getFacesBean(clazz.getSuperclass(), component);
}
}
> Error when rendering components trinidad
> ----------------------------------------
>
> Key: EXTVAL-140
> URL: https://issues.apache.org/jira/browse/EXTVAL-140
> Project: MyFaces Extensions Validator
> Issue Type: Bug
> Components: Trinidad Support
> Affects Versions: 2.0.5
> Environment: Projecto using
> - JSF 2.0.3
> - Trinidad 2.0.0-beta-2
> or
> - JSF 2.1.7-SNAPSHOT
> - Trinidad 2.0.2-SNAPSHOT
> Both
> Weld 1.1.4-Final
> Weld 1.1.5-Final
> Reporter: Igor Guimaraes
>
> Error processing trinidad components.
> For testing, I override the encodeBegin method, and it worked without
> super.encodeBegin
> There is a solution for this error?
> Caused by: java.lang.IllegalStateException: No CreationalContext registered
> for EL evaluation, it is likely that the the expression factory has not been
> wrapped by the CDI BeanManager, which must be done to use the ELResolver from
> CDI
> at
> org.jboss.weld.el.AbstractWeldELResolver.getELCreationalContext(AbstractWeldELResolver.java:148)
> at
> org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:123)
> at
> org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:96)
> at
> org.jboss.weld.environment.servlet.util.ForwardingELResolver.getValue(ForwardingELResolver.java:49)
> at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
> at
> com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
> at
> com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
> at
> org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getBean(DefaultELHelper.java:79)
> at
> org.apache.myfaces.extensions.validator.beanval.util.BeanValidationUtils.addMetaDataToContext(BeanValidationUtils.java:119)
> at
> org.apache.myfaces.extensions.validator.beanval.interceptor.ExtValBeanValidationMetaDataExtractionInterceptor.processExtValBeanValidationMetaData(ExtValBeanValidationMetaDataExtractionInterceptor.java:82)
> at
> org.apache.myfaces.extensions.validator.beanval.interceptor.ExtValBeanValidationMetaDataExtractionInterceptor.afterExtracting(ExtValBeanValidationMetaDataExtractionInterceptor.java:61)
> at
> org.apache.myfaces.extensions.validator.util.ExtValUtils.invokeMetaDataExtractionInterceptors(ExtValUtils.java:268)
> at
> org.apache.myfaces.extensions.validator.util.ExtValUtils.access$100(ExtValUtils.java:79)
> at
> org.apache.myfaces.extensions.validator.util.ExtValUtils$1.extract(ExtValUtils.java:236)
> at
> org.apache.myfaces.extensions.validator.beanval.BeanValidationModuleValidationInterceptorInternals.extractPropertyDetails(BeanValidationModuleValidationInterceptorInternals.java:64)
> at
> org.apache.myfaces.extensions.validator.beanval.BeanValidationModuleValidationInterceptor.initComponent(BeanValidationModuleValidationInterceptor.java:55)
> at
> org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.beforeEncodeBegin(AbstractValidationInterceptor.java:112)
> at
> org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.encodeBegin(ExtValRendererWrapper.java:162)
> at
> org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:987)
--
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