【问题标题】:Programmatically override value expression of composite-component’s attribute以编程方式覆盖复合组件属性的值表达式
【发布时间】:2018-08-25 10:42:00
【问题描述】:

我编写了一个包装器组件,它在某些情况下会覆盖其子组件的某些属性。

INVOKE_APPLICATION 阶段(事件之后),它在子组件上调用UIComponent#setValueExpression

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);  

一切都很好除了复合组件t作为孩子。

使用 composite-component,在 RENDER_RESPONSE 阶段重置值表达式并评估初始表达式。

这发生在CompositeComponentTagHandler$CompositeComponentRule$CompositeExpressionMetadata#applyMetaData

有解决方法吗?

我将 Payara 与 jsf-impl Mojarra 2.2.12 一起使用

【问题讨论】:

    标签: java jsf-2 jsf-2.2 composite-component mojarra


    【解决方案1】:

    刚刚调用UIComponent#setValueExpression 进一步进行PreRenderViewEvent 处理。

    【讨论】:

      猜你喜欢
      • 2019-02-20
      • 2013-05-19
      • 2020-07-28
      • 1970-01-01
      • 2022-11-17
      • 2015-04-07
      • 2011-10-21
      • 1970-01-01
      • 2020-11-09
      相关资源
      最近更新 更多