+ Start a Discussion
rajesh k 10rajesh k 10 

How to call session variables from one vf page to another?

Hi,
         I have 2 datepicker fields in my visualforce page.I will give these two date fields and when i click search how to store these dates in session variables and how to call these entered dates in another visualforce page(i implemented these pages for sites that's why there is no link between these pages How to call first entered date values to another visualforce page using sessions)?

help me.......
EnreecoEnreeco
You cannot use sessions in VF pages.
The only way I see are the following:
  • Use cookies to store some temp data (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites_cookie.htm )
  • Use some sort of temporary object linked to the current User to store the data (you can use the session id to get the correct object from the DB)
  • Pass the values to the query string when calling the next page (you can even encode in Base64 the values to avoid user see what you are doing)
The important fact is that you need to store the data somewhere: this could be client side (cookies), server side (custom object) or you don't store anything and simply pass it to the next page

--
May the Force.com be with you!