Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 72120 invoked from network); 4 Nov 2004 10:29:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Nov 2004 10:29:39 -0000 Received: (qmail 29304 invoked by uid 500); 4 Nov 2004 10:29:28 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 29152 invoked by uid 500); 4 Nov 2004 10:29:26 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 29139 invoked by uid 99); 4 Nov 2004 10:29:26 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [139.121.17.172] (HELO cpmx2.mail.saic.com) (139.121.17.172) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 04 Nov 2004 02:29:24 -0800 Received: from cp-its-ieg02.mail.saic.com by cpmx2.mail.saic.com for users@cocoon.apache.org; Thu, 4 Nov 2004 02:28:38 -0800 Received: from cp-its-exbh01.mail.saic.com ([139.121.17.137]) by cp-its-ieg02.mail.saic.com (SAVSMTP 3.1.6.45) with SMTP id M2004110402283806050 for ; Thu, 04 Nov 2004 02:28:38 -0800 Received: by cp-its-exbh01.mail.saic.com with Internet Mail Service (5.5.2657.72) id ; Thu, 4 Nov 2004 02:28:38 -0800 Message-Id: <7C6EC9550222914294F9F337038AB55ADD4887@uk-hemel.mail.saic.com> From: "Smith, Lee [OS-IE]" To: "'users@cocoon.apache.org'" Subject: Continuations and cleaning up Date: Thu, 4 Nov 2004 02:28:37 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hey All, New user to cocoon here, and I've got a question about the use of continuations in flow scripts. I'll explain my question with the following block of code: 1: function myFunc() 2: { 3: var myDB = Database.getConnection("myPool"); 4: myDB.setAutoCommit(false); 5: 6: .. do some work on the connection, don't commit 7: 8: cocoon.sendPageAndWait("confirm_changes.html"); 9: 10: if (cocoon.request.getParameter("confirm_changes") == "true") 11: myDB.commit(); 12: else 13: myDB.rollback(); 14: 15: cocoon.sendPage("change_made.html"); 14: } In this example I get a connection to a database, make some changes and then allow the user to confirm they are happy with the changes and then depending upon their response, either commit them or roll them back. Now this is all fine assuming the user follows the confirmation or cancellation links on the page - however, assuming there is a menu system on the confirmation page it is possible for the user to break out of the continuation without completing it, hence leaving uncommitted changes in the database. Is there anyway I can trap the user activating links on the site (assuming they activate another resource in the current site-map)? I have a feeling I may be thinking about this in too much of a Java-ish way and there should be another way I should be doing this :) I'm expecting somebody to say "Why not let the user confirm any changes before applying them to the database", well the reason for doing this is it allows me to trap any errors (ie. things like duplicate keys, or invalid foreign keys) that show up when you apply the changes to the db and then show these to the user before I ask them if they are happy with the changes. Anyway, thanks in advance for any advice :) Lee --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org