How to retain a Last assigned value to a field in vaadin

Hi all,

      In my vaadin application i used many static variables .But from forum i understand that static variables should not be used in vaadin . 
      Because it could also be shared  to other users .Somebody said that ThreadLocal pattern will solve this problem .But i used that it couldn't solve my problem.
     Somebody said that without staic methods and threadLocal you can achieve that but how this is possible?
      How can i implement this clearly ?

Thank you all.

You need neither static variables nor ThreadLocals. Just use plain OOP and instance-variables. Every Application-instance (and therefore all the view-components and stuff) is saved in the user-session and only accessible by that one specific user.

Is this the same as your question in a different thread? If so, sorry for my late response if that made you try to rephrase your question.
Here is my response on that thread
.

Cheers,
Bobby

To save you some time, though, I basically said what Tobias did but not as concisely. :slight_smile:

Hi all,

       Sir , I have remove all static variables from my project .It works well with one user but if another user comes into play , the action done by one user is shown 
       to another  user. Acutally i opened two tabs in same browser . I changed the code for multitabs according to the forum.Still i couldn't recover from this problem.
       Now i only used the instance variables in my one of the class and take that variable by using object reference of that class to all the classes.
       Please give some solution.

Thank you all.

Well no chance to figure that out without some code. Are you sure that you have two distinct sessions?

Hi sir ,
Now i removed all static variables.
and i am in a safer side and my project working properly with
different users.What does it mean that you asked " you have two distinct sessions?". Which means application has two seperate sessions.
Now i am facing out of sync error and tomcat log file shows that
Warning: Ignoring variable change for non-existent component, VAR_PID=PID510

     Please give some solution. 

Thank you sir for your quick response.

Try two browsers. Multiple tabs/windows from the same browser all share the same session because they share the same cookie.

So one browser == one user, no matter how many tabs you have open (though there are workarounds). I regularly use Chrome, FireFox, Safari, and Opera for this very reason.

Cheers,
Bobby

Sir,
You are correct sir. If i access the application from the different browser , there is no out of sync error .

Thank you sir for your valid information.