Sample usage of session storage in custom form and in controller. This module having below file structure.
AddressForm.php and StudentForm.php having sample code for procedural way of usage of session.
First access path /session/add-student , values are setting in session and redirects to path /session/add-address and here after submission, we are retrieving the stored values and displays it.
Access path /session/controller-form using dependency injection we are setting values in session using dependency injection and retrieving values in controller.
you can see all path mappings in file dn_sessionstorage.routing.yml.
See this article for more about temporary storage.