Tuesday 22 November 2016

Method call on page Load in ADF -

Hi All ,Today i'll show how we can call a method before page load in adf.

I have an requirement After registration I have to send a Activation Url to User's Account.
Once User will click on url he will land into login page and init method will load before login Page.

Step1- Once user registered will get the url like below below screen shot.



Step2- once user will click on url he will land to login page,before landing to login page init() method will call below is the method in login bean class.

    @PostConstruct
       public void init() {
            AdfFacesContext adfCtx = AdfFacesContext.getCurrentInstance();
            Map vmap = adfCtx.getViewScope();
       
            loginId = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("loginId");
            if(loginId != null && vmap.get("loginId") == null ) {
                vmap.put("loginId", loginId);
                userAction = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("ulmsg");
             
                    DCBindingContainer dbc = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
                    OperationBinding op = dbc.getOperationBinding("userLoginMsg");
                    op.getParamsMap().put("loginId", loginId);
                    op.getParamsMap().put("type", userAction);
                    vmap.put("wmsg", op.execute());
            }
         
        }
this method gets the id and ulmsg from the request parameter.

  please make a note that java EE @PostConstruct bean is called once for each bean instantiation. In the managed bean case, the bean is instantiated once per application or session and so is the method executed once. 

Step3- After loading the method login page will appear like below screen shot.



Step4- Once User will success logged in he/she will redirect to payment page,below is the screen shot.



so if any body need to load method before loading the page he/she can use @PostConstruct or use the phase listener in the page like.


<f:view beforePhase="#{ManagedBean.onBeforePhase}">
implements PagePhaseListener and override two method.
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
// write your code which needs to load before page load
}
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
}
Thanks to here me :)

Eclipse With Python

Hi Guys, Today i'll share how to start python project in eclipse IDE. to start Py development in eclipse we need to add Py Dev plugi...