调用EL表达式代码:如:#{st1} public void getExpressionInvoke(String El, SelectionEvent selectionEvent) { FacesContext fctx = CurrentInstance(); ELContext elctx = ELContext(); ExpressionFactory expressionFactory = null; expressionFactory = Application().getExpressionFactory(); MethodExpression methodExpression = null; methodExpression = ateMethodExpression(elctx, El, Object.class, new Class[] { Class() }); methodExpression.invoke(elctx, new Object[] { selectionEvent }); } 1. //获取binding容器 2. BindingContainer bindings 3. = Current().getCurrentBindingsEntry(); 复制代码 1. //获取Page definitions的 attribute的值 2. AttributeBinding attr = (ControlBinding("test"); 3. attr.setInputValue(”test”); 复制代码 1. // 获取action或者方法 2. OperationBinding method = OperationBinding("methodAction"); 3. ute(); 4. List errors = Errors(); 5. 6. method = OperationBinding(”methodAction”); 7. Map paramsMap = ParamsMap(); 8. paramsMap.put(”param”,”value”) ; 9. ute(); 复制代码 1. // 从ADF Tree 或者 Table中获取数据 2. DCBindingContainer dcBindings = (Current().getCurrentBindingsEntry(); 3. FacesCtrlHierBinding treeData = (ControlBinding(”tree”); 4. Row[] rows = AllRowsInRange(); 复制代码 1. // 从iterator 的当前行获取一个 attribute的值 2. DCIteratorBinding iterBind= ((”testIterator”); 3. String attribute = (CurrentRow().getAttribute(”field1″); 4. <code> 5. <code lang="java"> 6. // 获取错误 7. String error = Error().getMessage(); 复制代码 1. // 刷新iterator 2. freshControl(); 3. uteQuery(); 4. fresh(DCIteratorBinding.RANGESIZE_UNLIMITED); 复制代码 1. // 获取 iterator的所有行 2. Row[] rows = AllRowsInRange(); 3. TestData dataRow = null; 4. for (Row row : rows) { 5. dataRow = (TestData)((DCDataRow)row).getDataProvider(); 6. } 复制代码 1. //获取iterator当前行的另一种方法 2. FacesContext ctx = CurrentInstance(); 3. ExpressionFactory ef = Application().getExpressionFactory(); 4. ValueExpression ve = ef.ELContext(), “#{stIter.currentRow.dataProvider}”, TestHead.class); 5. TestHead test = (ELContext()); 复制代码 1. // 获得一个on bean 2. FacesContext ctx = CurrentInstance(); 3. ExpressionFactory ef = Application().getExpressionFactory(); 4. ValueExpression ve = ef.ELContext(), “#{testSessionBean}”, TestSession.class); 5. TestSession test = (ELContext()); 复制代码 1. //获取askflow的Binding 2. DCTaskFlowBinding tf = (DCTaskFlowBinding)dc.findExecutableBinding(”dynamicRegion1″); 3. <code> 4. <code lang="java"> 5. //获取异常并显示到页面 6. catch(Exception e) { 7. FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), “”); 8. CurrentInstance().addMessage(null, msg); 9. } 复制代码 1. // 重置控件的所有子控件 2. private void resetValueInputItems(AdfFacesContext adfFacesContext, 3. UIComponent component){ 4. List items = Children(); 5. for ( UIComponent item : items ) { 6. resetValueInputItems(adfFacesContext,item); 7. if ( item instanceof RichInputText ) { 8. RichInputText input = (RichInputText)item; 9. if ( !input.isDisabled() ) { 10. setValue() ; 11. adfFacesContext.addPartialTarget(input); 12. }; 13. } else if ( item instanceof RichInputDate ) { 14. RichInputDate input = (RichInputDate)item; 15. if ( !input.isDisabled() ) { 16. setValue() ; 17. adfFacesContext.addPartialTarget(input); 18. }; 19. } 20. } 21. } 复制代码 1. // 重定向到另一个URL 2. ExternalContext ectx = CurrentInstance().getExternalContext(); 3. HttpServletResponse response = (Response(); 4. String url = RequestContextPath()+”/adfAuthentication?logout=true&end_url=/faces/start.jspx”; 5. try { 6. response.sendRedirect(url); 7. } catch (Exception ex) {el表达式获取session中的值 8. ex.printStackTrace(); 9. } 10. <code lang="java"> 11. // 刷新控件(PPR) 12. CurrentInstance().addPartialTarget(UIComponent); 13. // 查控件 14. private UIComponent getUIComponent(String name) { 15. FacesContext facesCtx = CurrentInstance(); 16. ViewRoot().findComponent(name) ; 17. } 复制代码 1. //获取 bc application module 2. private OEServiceImpl getAm(){ 3. FacesContext fc = CurrentInstance(); 4. Application app = fc.getApplication(); 5. ExpressionFactory elFactory = ExpressionFactory(); 6. ELContext elContext = fc.getELContext(); 7. ValueExpression valueExp = 8. ateValueExpression(elContext, “#{data.OEServiceDataControl.dataProvider}”, 9. Object.class); 10. return (Value(elContext); 11. } 复制代码 1. //获取table选中的行 2. RowKeySet selection = SelectedRowKeys(); 3. Object[] keys = Array(); 4. List receivers = new ArrayList(keys.length); 5. for ( Object key : keys ) { 6. User user = ((Integer)key); 复制代码 1. // 获取table选中的行的另一种 2. for (Object facesRowKey : SelectedRowKeys()) { 3. table.setRowKey(facesRowKey); 4. Object o = RowData(); 5. JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o; 6. Row row = Row(); 7. Test testRow = (Test)((DCDataRow)row).getDataProvider() ; 8. } 复制代码 |
发表评论