Posts

How to set default values of view object in Oracle ADF

Image
When we insert new data in a row or when we call the create method of the view object, we may need some data by default in every row. This requirement has inbuilt support in Oracle ADF. We can complete this requirement by editing the EntityObject XML Step 1- Open the EntityObject.xml file Step 2- Go to the Properties and click on the Attributes section   Step 3- Select the particular attribute for which you want to have default values   Step 4- In the Default value section provide the literal value, this value will be put by default when you will try to add a new row We have put the value "Drake", now this value will be used when we will try to add new row in the view object EmployeesVO            

How to refresh a component in Oracle ADF Programmatically

 There are many scenarios when we have to refresh the UI Component or Values in any Component on the Page. We can achieve this functionality by using this code in the ADF Managed Bean. Step 1-  We need to create binding of the component which is to be refreshed. Step 2- Add this method in the Button Action Listener or Value Change Listener along with the created Binding name of the component. AdfFacesContext.getCurrentInstance().addPartialTarget(compBinding); //here compBinding is the Binding of the component

How to refresh page in Oracle ADF by using method

There are many scenarios when we have to refresh the Page by clicking on any Button or using Action Listener. We can achieve this functionality by using this code in the ADF Managed Bean.   Step 1- Add this given method in the bean and import the relvent methods private void refreshPage() { FacesContext fctx = FacesContext.getCurrentInstance(); String page = fctx.getViewRoot().getViewId(); ViewHandler ViewH = fctx.getApplication().getViewHandler(); UIViewRoot UIV = ViewH.createView(fctx, page); UIV.setViewId(page); fctx.setViewRoot(UIV); }   Step 2- After writting the method we have invoke that particular method in Acton Listner or wherevere we want. public void buttonAL(ActionEvent actionEvent) { refreshPage(); }