How to deal with a session when a tab in the same browser is opened?
-
24-05-2021 - |
質問
I am working Stripes framework. I have a table which contains 100's of rows which has edit and delete links. The data might be either year 2010 or 2009. I can only filter by year. i.e 2009's and 2010's data can't be displayed in one page.
Problem:
Both 2009 and 2010 data has everything the same except their year. So the key is (year + someString)
First, I opened 2009's data then in the same browser but another tab I opened 2010's data. So when I opened 2010's data (which i filtered out by year) the session sets the selectedYear as 2010.
For delete there is a query which looks like
**delete ... where someString=string and year=selectedYear )**
when I try to delete one of 2009's data, what it does is, it deletes a row from 2010's (everything is the same except the year). I think it is because the selected year is 2010.
How can I solve this ?
解決
Don't put selectedYear in your session, you should put selectedYear on your action bean in a variable that get set by the URL/Form you use to do things with the data.