ADF Refresh page jsf with page fragments jsff after set session variable

1.1k views Asked by At

I have a template which includes a button that let you select a profile, you push the button and appear the available profiles, choose one and push accept. After that I set a variable session successfully.

I have a "First" jsf page with two jsff page fragments from a View Link. The view link is composed by a headerView and detailView. The headerView had a bind variable. What I need is that parameter (bindVariableParameter) can be set by the session variable of the template.

This is what I get:

I am in a home page (separate Application Module), I push the template button before I load de "First" jsf page and after that I go to the "First" jsf page the information is loaded successfully. What I do in the Application Module is something like that:

protected void prepareSession(Session session) {
Map sessionScope = ADFContext.getCurrent().getSessionScope();
String company = (String)sessionScope.get("compId");
System.out.println("Default Comapny in BC is: " + company);
super.prepareSession(session);
this.getSession().getUserData().put("Company", company);
System.out.println("After setting value in userData map of BC");
}

And in the bind variable expression of the headerView I use:

adf.userSession.userData.Company

It works great!!!! But!!!! When I press the button again and I choose another profile, the info is not updated. Neither in the headerView neither in the detailView.

Also, when I go to the "First" jsf page (without previously push the template button), I got no info, which is right, because I don't have any session variable. After that I push the template button and select the profile, but the page is not refreshed.

I tried several ways to to this but I'm lost.

Could you help me?

Regards.

1

There are 1 answers

2
Florin Marcus On

You have two options for this:

  1. Option one: tune your AM as follows:

    jbo.doconnectionpooling=true

    jbo.txn.disconnect_level = 1

    This will ensure prepareSession() method is being called before each operation. This happens to be a best practice in ADF productions systems, increasing scalability (see here )

  2. Option two: Better than using prepareSession(), you can pass the Http Session data to ADF BC through a custom DataControlFactory. You can find an example here: http://andrejusb.blogspot.co.uk/2012/05/solution-for-sharing-global-user-data.html