Opening two edit pages at once - data corruption

I have a simple jsf page with a table of Employees, now when the user clicks on a button edit, I put the employee with the associated row on the session map and open the edit employee page which uses the Employee from the session map for manipulating the data. Now what can happen is that that the user would try to edit two Employees at once, with the "open page in new window" from his/hers browser meaning that both pages will refer to the same object hence when the user will press save then the other Employee record will get corrupted which is very bad.

How did you solve this issue?

[602 byte] By [HaKia] at [2007-11-27 0:23:02]
# 1
http://forum.java.sun.com/thread.jspa?threadID=5154861&messageID=9589645#9589645(How to avoid a sessionbean conflict while Tabbed Browsing?)
Ingmara at 2007-7-11 22:18:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

> How did you solve this issue?

Use request scope instead of session scope. You can save stuff from request to request using h:inputHidden or requestParameterMap.

This article might be interesting: http://balusc.xs4all.nl/src/dev-jep-dat.html

It also covers using datatables in request scope.

BalusCa at 2007-7-11 22:18:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
BalusC means http://balusc.xs4all.nl/srv/dev-jep-dat.html(srv instead of src)
Ingmara at 2007-7-11 22:18:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Oops, a typo. Well, apparently I can't edit that message anymore .. It is indeed /srv/.
BalusCa at 2007-7-11 22:18:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Today I realized that there is a new JSF version 1.1.02 which is shipped with Netbeans 5.5 + VWP. This version is writing a new hidden parameter (<input type="hidden">) com.sun.faces.VIEW in the HTML output and uses a session attribute "con.sun.faces.logicalViewMap" instead of "com.sun.faces.VIEW_LIST". With this "new" feature you should be able to store more than one business object of the same type in one session under some window ID and benefit from all JSF features without workarounds. I removed a part of my own window management and it seems to work.

Ingmara at 2007-7-11 22:18:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...