Hello fellas,
today i'm sharing my learning to how to show current date and time in adfFirst take a JSF(jspx) page and take a output field,
create a managed bean, of the type Date(by extending java.util.Date),
make, value of the output field of the type of your bean
output will be like this,
use a convert date and time in the output field used. by searching it from component pallete and choose this one as we are using jspx.
use poll from the operations under component palette, set interval of the poll to 1000,
make a bind variable name, create getters and setters.
select the poll from the structure, and go to the poll listner, and connect this listener to this refreshPage method
bind the output text to the dates variable provided.
code to be provided.
public void refreshPage(PollEvent pollEvent) {
refresh();
AdfFacesContext.getCurrentInstance().addPartialTarget(dates);
}
protected void refresh() {
FacesContext ctx = FacesContext.getCurrentInstance();
String refreshpage = ctx.getViewRoot().getViewId();
ViewHandler views = ctx.getApplication().getViewHandler();
UIViewRoot view = views.createView(ctx, refreshpage);
view.setViewId(refreshpage);
ctx.setViewRoot(view);
}
run the page.
you can download the application from here App
thank you :)