Reputation: 5977
The code already exist and i have less time
I Open Tab 1 in browser - JSP Page XYZ
opened for ID 100 contains session.setAttribute("100",ID)
Then, Open Tab 2 in same browser - Same JSP Page XYZ opened for ID 101 contains session.setAttribute("101",ID)
when Tab 1 is updated (form fields updated) for ID 100
,,, the whole updations are done to Tab2 i.e ID 101, which means session got shared among tabs and all session variables are updated.
On Servlet side there is Controller have session.getAttribute("ID")
and it updates data and store result again in session like session.setAttribute("Result",object)
It is hauch pauch management of session.
Now i want to work tab independent of each other, with minimal work. How can i do that in JSP?
I have find URL rewriting using encodeSendRedirect()
but it is not returning to page XYZ page.
Upvotes: 1
Views: 726
Reputation: 316
Session cookies are normally shared in modern browsers across different tabs. You cannot maintain separate session for each tab.
You may add some hidden form attribute with random number while returning requested page from server side for the first time. This random number you can conceptually store in session and map it to Tab1. And you may use that hidden form attribute to distinguish data of different tabs to retrieve object from session.
Upvotes: 1