On my web app, I have a page with 3 iFrames. Each iFrame does a similar request to server to load a page but they send their own unique pageId to server. For e.g. frame 1 request sends pageId=100, frame2 sends pageId=101 and frame3 sends pageId=102. Same
servlet method is called on server side for each frame.
That serverside method (say sharedMethod()) calls setAttribute/getAttribute methods on session object BUT most important point is setAttribute/getAttribute append pageId to attribute names to make them unique per page. That means if I have a session attribute TITLE, shareMethod() sets/gets attribute name TITLE100, TITLE101 AND TITLE102 for each page, same attributes names are not used.
Sometimes I see nullpointer exceptions, which I am unable to trace so far - it happens rarely. One doubt I have is do I need to synchronize access to sharedMethod or at least to code that manipulates session object? If yes, can you explain to me why is the need?