function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dipu T.PaulDipu T.Paul 

How to set a session attribute in Apex class

How to set a session attribute in Apex class.
David VPDavid VP
session var's don't exist in VF.

also see : link

What are you trying to accomplish ?


David
Dipu T.PaulDipu T.Paul
Hi David,
 
I have a contoller class.In that class i have a set method like
 
private String storeId;
 
 public void setStoreId(String storeId)
{
   this.storeId=storeId;
}
 
In the same class  i have  one more method which return an Object.
 
  public Store__c  getCategoryName() {

//Here  i am getting the   "storeId"  field  as null.   

            Store__c categoryVO = emissionService.getCategoryName(storeId);

      return categoryVO;
       }
 
 
But in the setter method i am getting the proper value.When it comes to "getCategoryName() ",the value will be null.
So i think to keep the value in session.Please provide your suggestions.