Hi,
I'm trying to use the flowscript capabilities for my application but it
appears not to be working. The problem I'm experiencing is that when an
earlier Continuation is resumed, it appears that the local variables do not
have the value corresponding to that continuation. Here is the script I'm
testing:
<<
function main() {
var nextPage = "";
var test = 1;
var pageStack = new java.util.Stack();
pageStack.push("reason-input");
cocoon.sendPageAndWait("process",{});
while (pageStack.peek() != "print") {
var currPage = "" + pageStack.peek();
var nextButton = "";
// First check for any validation errors
if (validationErrors()) {
// display same page again
nextPage = pageStack.peek();
pageStack.pop(); // remove current page
}
else
if (backPressed(currPage)) {
// Handle Back button here
pageStack.pop();
nextPage = "" + pageStack.peek();
}
else
switch (currPage) {
case "details-input":
case "details-input-3":
nextButton =
cocoon.request.get("cocoon-action-details-Next");
if (nextButton)
nextPage = "summary";
break;
case "reason-input":
var reasonSelect =
cocoon.request.get("globalreason");
test = 2;
if (reasonSelect ==
"no-longer-PAYE")
// Outputs contact
details page
nextPage = "details-input";
if (reasonSelect ==
"no-deductions")
// Outputs contact
details page
nextPage = "details-input";
if (reasonSelect == "individual")
nextPage = "individual-input";
break;
case "individual-input":
nextButton =
cocoon.request.get("cocoon-action-individual-Next");
if (nextButton)
nextPage = "details-input-3";
break;
case "summary":
nextButton =
cocoon.request.get("cocoon-action-summary-Print");
if (nextButton)
nextPage = "print";
break;
} // end switch
pageStack.push(nextPage);
cocoon.sendPageAndWait(nextPage, {});
} // end while
cocoon.sendPage(nextPage, {});
}
function validationErrors() {
var results =
cocoon.request.getAttribute("org.apache.cocoon.acting.FormValidatorAction.re
sults");
if (results != null) {
if (results.size()) {
var ok = results.get("*");
if (ok == "ERROR") {
return "true";
}
else {
return "";
}
}
}
else {
return "";
}
}
function backPressed(page) {
var result = "";
var index = page.indexOf("-");
if (index != -1) {
var pagePrefix = page.substring(0, index);
var buttonName = "cocoon-action-" + pagePrefix + "-Back";
var backButton = cocoon.request.get(buttonName);
if (backButton) {
result = "true";
}
}
return result;
}
>>
Looking at the local variable "test", if I use the browser back button to
the very first page and submit it again, I epxect it to have the value '1',
but it actually has the value '2', corresponding to the continuation after
the "reason-input" page. If I set a breakpoint in the code and inspect the
Continuation object, it has changed after the second continuation.
So it looks like this is a bug, but I'm not really sure. Maybe anybody has
the same experience and knows what I'm doing wrong?
I'm using Cocoon 2.1, JDK 1.4.1_03 and Tomcat 4.1.24.
Regards,
Francis
Ing. Francis RA Vermeulen
EzGov
Senior Architect
"De Schinkel" Rijnsburgstraat 11
1059 AT Amsterdam
Tel. (Office): +31 (0)20 7133924
Fax: +31 (0)20 7133799
E-mail: [EMAIL PROTECTED]
Website: www.europe.ezgov.com
The information contained in this communication is confidential and may be
legally privileged. It is intended solely for the use of the individual or
entity to whom it is addressed and others authorised to receive it. If you
are not the intended recipient you are hereby notified that any disclosure,
copying, distribution or taking any action in reliance on the contents of
this information is strictly prohibited and may be unlawful. EzGov B.V. is
neither liable for the proper and complete transmission of the information
contained in this communication nor for any delay in its receipt.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]