JSF事件处理
值更改事件的两种处理方式:
1.方法绑定: 将ManagedBean的方法传递到valueChangeListener属性上。
2.实现ValueChangeListener接口。
①需要实现processValueChange()方法
②配置时使用<f:valueChangeListener type="全路径">
动作事件:点击命令控件/超链接时触发
1.在UI组件的actionListener中进行方法绑定
注意:commadButton的action用于导航规则,绑定的方法不是actionListener中的方法,它没有参数,actionListener在此之前触发。
2.实现ActionListener接口
①重写processAction方法
②配置时使用<f:actionListener type="全路径">
与生命周期有关的Application事件:
事件类型:
1.方法绑定:
2.实现SystemEventListener接口
①实现SystemEventListener,并重写processEvent方法
②在faces-config.xml中配置