简体   繁体   中英

Programmatically override value expression of composite-component’s attribute

I have written a wrapper component that in certain conditions overrides some attributes of its children.

In the INVOKE_APPLICATION phase (after an event), it calls UIComponent#setValueExpression on child components :

FacesContext ctx = FacesContext.getCurrentInstance();
ELContext eLContext = ctx.getELContext();
ExpressionFactory factory = ctx.getApplication().getExpressionFactory();
String newModelExpression = "#{newExpression}";
ValueExpression exp = factory.createValueExpression(eLContext, newModelExpression, Object.class);
((UIComponent) child).setValueExpression("model", exp);  

Everything is fine except with composite-componen t as child.

With composite-component , the value expression is reset in the RENDER_RESPONSE phase and the initial expression is evaluated.

This happens in CompositeComponentTagHandler$CompositeComponentRule$CompositeExpressionMetadata#applyMetaData .

Is there a workaround for that ?

I'm using Payara with jsf-impl Mojarra 2.2.12

只是在进一步的PreRenderViewEvent处理中调用了UIComponent#setValueExpression

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM