Maintaining database state across session.

Eugene Kuleshov

[You could store the Connection object somewhere, but that's] not a very good approach anyway.

You better show a confirmation dialog before sending anything to server. You may also put everything within a session (or hidden fields if you hate sessions) and do the real update only on real confirmation.