本文介绍了在PhaseListener中修改JSF组件树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到问题了.

我已经实现了PhaseListener,它旨在向树中任何附加了消息的UIInput组件添加一个样式类,并在没有附加任何消息的情况下删除该样式类.

I've implemented a PhaseListener, which is meant to add a style class to any UIInput components in the tree that have messages attached to them, and removes the style class if it doesn't have any messages attached to them.

PhaseListener在RENDER_RESPONSE阶段运行,并且在调试时可同时用于beforePhase和afterPhase方法.调试时,我发现beforePhase不能访问整个组件树,但是afterPhase可以访问.在afterPhase中所做的任何更改都不会呈现.

The PhaseListener runs in the RENDER_RESPONSE phase, and does it's work in both the beforePhase and afterPhase methods while debugging. While debugging, I found that beforePhase doesn't have access to the full component tree, but afterPhase does. Any changes done in afterPhase aren't rendered though.

我该如何处理?我希望这完全是服务器端.

How do I go about this? I want this to be completely server side.

谢谢

詹姆斯

推荐答案

使用ViewHandler实现,但是效率不高. 渲染响应"阶段的PhaseListener无法访问组件树.

Implemented using a ViewHandler, however it's not efficient. PhaseListener in Render Response phase doesn't have access to the component tree.

这篇关于在PhaseListener中修改JSF组件树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 04:43