How to Enable Session in Vaadin

Hi All,
I have used Vaadin in a small application, and i am facing a problem in providing different sessions to each instance of the application.


Few details
:-

  1. The application has two tabs, ‘Dashboard’ and ‘Report Tab’.
  2. The mainWindow which contains all the UI, has a horizontal Layout. The contents on that Horizontal Layout Changes every time the user switched between the tabs.
  3. i have ignored class level variables to the maximum.
  4. There are two static variables which provide data from the database to the Different Views.


Functionality

By default the Dashboard tab is being selected
User chooses any particular entry from the dashboard, the content of the application Layout changes and goes to FormView, where the user gets to enter some kind of details and than the user can save and other related stuff.
if the user chooses the Report Tab, than he enters some data in the field, user clicks on “get report” button and than the user gets the report.


Problem

if two person are using the application at the same time(on different machines), now when user A is on DashBoard and user B clicks on “get Report” button on the Report Tab, User B should get a particular kind of report on the basis of given fields, instead the application jumps to Dashboard View.

Please help me in implementing sessions in the application, or maybe something equivalent.

Thanks.

First you will need to add the support for multiple windows. I think there is a chapter in the book about it but I could only find
this wiki page
so that you can test multiple users without the need of multiple machines.

Then your main problem comes from the static variables as they will be shared through every user on the server. In order for it to work check
this page of the book
and if you decide to use the thread local pattern, you can also check
this wiki page.