我正在浏览Mojarra JSF-IMPL 2.1.19的来源,以了解内部。但是我找不到在应用请求值阶段中调用操作方法的逻辑(applyrequestValuesphase.ectecute方法...和在该内部调用的方法)strong>。任何人都可以帮助我找到它。
预先感谢。
是执行解码和动作事件排队工作的渲染器。如果Mojarra专门实施<h:commandButton>
,则是ButtonRenderer
。这是其decode()
方法中相关性的摘录:
77 public void decode(FacesContext context, UIComponent component) {
78
79 rendererParamsNotNull(context, component);
80
81 if (!shouldDecode(component)) {
82 return;
83 }
84
85 String clientId = decodeBehaviors(context, component);
86
87 if (wasClicked(context, component, clientId) && !isReset(component)) {
88 component.queueEvent(new ActionEvent(component));
89
..
97 }
98
99 }
请参阅,它将进一步委派到组件自己的queueEvent()
方法。<h:commandButton>
的组件类是从UICommand
延伸的HtmlCommandButton
。它的queueEvent()
方法依次实现如下:
335 public void queueEvent(FacesEvent e) {
336 UIComponent c = e.getComponent();
337 if (e instanceof ActionEvent && c instanceof ActionSource) {
338 if (((ActionSource) c).isImmediate()) {
339 e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
340 } else {
341 e.setPhaseId(PhaseId.INVOKE_APPLICATION);
342 }
343 }
344 super.queueEvent(e);
345 }
看吗?执行操作事件的目标阶段是根据组件的immediate
属性确定并设置的。