Hello All,
in this tutorial i am going to explain that how to show current date and time on your ADF application page
Follow Steps-
in this tutorial i am going to explain that how to show current date and time on your ADF application page
Follow Steps-
- Create a fusion web application and a page in it (i have used .jspx page)
- Now drag an output text from component palette and drop it on page
- Now select the output text and go to its property inspector then select value from Expression Builder as shown in image
- Now in Expression Builder ,create a Managed Bean of type java.util.Date and assign its value to output text
- Now run your page and see current date is there
- Now to format Date and Time , drag and drop af:convertDateTime under output text from component palette
- Select convertDateTime and go to property inspector and change its pattern and run your page
- Now you have done basic configuration for Date/Time, if you want to refresh time (second and minute part) on page periodically then drop a poll component in page and create a poll listener in managed bean
- Now write this simple code in your managed bean to invoke poll listener
- Now Run your application , see in this video clip how your page get refreshed... Cheers ..!
/**Binding of Output text*/ private RichOutputText dateBind; public void setDateBind(RichOutputText dateBind) { this.dateBind = dateBind; } public RichOutputText getDateBind() { return dateBind; } /**Poll Listener Method ,handles Poll Event * @param pollEvent */ public void refreshTime(PollEvent pollEvent) { AdfFacesContext.getCurrentInstance().addPartialTarget(dateBind); }
And don't forget to set clientComponent property of outputText to true