cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugh Sparks" <>
Subject Cannot create a session after the response has been committed
Date Fri, 01 Aug 2008 04:02:32 GMT
I have a webapp I've been using since the coccon 2.1x era.
It still works with 2.2.1. It is a simple one page cform
that uses ajax.

But today, I felt the need to enable exception handling 
in the sitemap. As soon as I did, I saw that the webapp
was throwing an exception and it stopped working:

"Cannot create a session after the response has been committed"

If I remove the exception handler, the program appears to work.

It seems I've been doing something wrong for years without knowing it. 

I tore apart the flowscript and found that the error was
caused when there were global variables in the script.
As soon as I made them all local, the problem went away.

I understand that somehow global variables in flowscript
are attached to the session. But nowhere in my program is
the session handled explicity. But evidently, I should be
doing something else to make this work. I do need the
variables to be global and attached to the session.

Here is an entire flowscript that demonstrates the problem:


 cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js") ;

 function startup()
 {     var form = new Form("form.xml");
        form.showForm("form-display") ;


 cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js") ;

 var form ;

 function startup()
 {     form = new Form("form.xml");
        form.showForm("form-display") ;

I don't know if this matters, but the script never uses a
"send page and wait." In the real script, there are functions
associated with all the fields and buttons.

The pipeline for the display and continuation handling are
copies taken from the samples.

How should I be dealing with the session to avoid this error?

Thanks to all,

-Hugh Sparks

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message