Wednesday, 24 October 2012

Get and set the values using Session in OAF


I faced a issue in OAF customization where the value is not getting retained when the page returns a error. Yes , when an action returns an error the code wont process further. The page wont load once again to retain the value.
                I spend lots of time in clearing this issue.  At last I manually stored the selected value in session and got it when I needed it.

I need the value to be retrieve when the button clicked. So I set the value in the Process Form Request.
I got the value in PR and set it back when the page loaded once again.


Set the value with this:

pageContext.putSessionValue("RetainEffDate",dateFieldBean.getText(pageContext).toString()); pageContext.putSessionValue("PossibleDate",convertedDateString.toString());

Give a name for the session and store the string value along with it.

Get the Session value where you need it with this :
  

dateFieldBean.setText(pageContext.getSessionValue("RetainEffDate").toString());


In this I am setting the Session value to a DateField bean. pageContext.getSessionValue("RetainEffDate").toString() will return the stored session value.

No comments:

Post a Comment