jsf ActionListener 查找正确的UIComponent
来源:互联网 发布:qt初学者 知乎 编辑:程序博客网 时间:2024/05/15 13:29
package com.xiuye.jsf.listener;import javax.faces.component.UIComponent;import javax.faces.component.UIOutput;import javax.faces.component.UIViewRoot;import javax.faces.component.html.HtmlBody;import javax.faces.component.html.HtmlForm;import javax.faces.component.html.HtmlOutputLabel;import javax.faces.context.FacesContext;import javax.faces.event.AbortProcessingException;import javax.faces.event.ActionEvent;import javax.faces.event.ActionListener;public class MyActionListener implements ActionListener{@Overridepublic void processAction(ActionEvent arg0) throws AbortProcessingException {FacesContext fc = FacesContext.getCurrentInstance();UIViewRoot root = fc.getViewRoot();UIComponent comp = root.findComponent("OK");/*System.out.println(root.getChildCount());System.out.println(root.getClientId());System.out.println(root.getId());System.out.println(root.getChildren().get(1));System.out.println(root.getChildren().get(2));System.out.println(root.getChildren().get(3));*///HtmlOutputLabel out = (HtmlOutputLabel)comp;//xhtml文件跟元素从<html>,h:head, h:body,</html>开始//jsp从<f:view>开始for(UIComponent c : root.getChildren()){if(c instanceof HtmlBody){for(UIComponent i : c.getChildren()){//System.out.println(i);if(i instanceof HtmlForm){HtmlOutputLabel label = (HtmlOutputLabel) i.findComponent("OK");if(label != null){label.setValue("rrrrrrrrrrrrrrrr");}}}}//System.out.println(c);}//out.setValue("123456");}}
0 0
- jsf ActionListener 查找正确的UIComponent
- 用JavaScript调用JSF的Action, ActionListener
- JSF中action 和 actionListener的区别
- JSF中action 和actionListener的区别
- JSF中action 和actionListener的区别
- JSF之Action 与ActionListener的区别
- JSF之Action 与ActionListener的区别
- jsf Action 与 ActionListener
- jsf Action 与 ActionListener
- jsf中action、actionlistener、valueChangeListener的区别(转)
- UIComponent
- JSF in Action读书笔记(二)自定义UIComponent
- 基础的ActionListener响应
- ActionListener的用法
- UIComponent的生命周期(life cycle)
- UIComponent的生命周期(life cycle)
- 正确的二分查找
- ActionListener
- MySQL外键设置中的的 Cascade、NO ACTION、Restrict、SET NULL
- c#中调用DLL
- 静态语言和动态语言
- [LeetCode-230]Kth Smallest Element in a BST
- 常用java编译器总结
- jsf ActionListener 查找正确的UIComponent
- iOS 上传头像处理
- 149,关闭键盘
- iOS高级开发——CollectionView的cell长按事件实现
- iOS 动画效果弹出提示视图
- Linux命令小计
- Struts回顾
- 应用接管三方库的日志
- IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)