Andre Juffer wrote:
Joerg Heinicke wrote:
On 26.02.2008 04:04, Andre Juffer wrote:
var form = new Form(...);
form.createBinding(...);
var finished = false;
var data = new ...;
while (!finished)
{
try {
form.load(data);
form.showForm(...)
form.save(data);
do_something_with(data);
finished = true;
}
catch (ex)
{
var w = form.lookupWidget("messages");
w.addMessage(ex.message);
}
}
cocoon.sendPage(...);
Is it only me wondering how this can work at all when there is an
exception? In that case finished is NEVER set to true and you always
get into an infinite loop. How can this work with Tomcat? Or am I just
missing something?
If there is an exception, it should be caught by the catch (ex) portion,
which extracts the message and puts it in the message form. finished
remains false (you are entirely right) and the form is being displayed
again to the user as I intended. If there is no exception, finished is
set to true and the while loops ends. The script ends with the
cocoon.sendPage(). This has worked fine with tomcat. Maybe I am too much
of Java programmer such that I miss certain things in Javascript.
Now, I agree with Joerg that this code looks very suspicious; I guess
your intention is to catch an exception while dealing with the data in
"do_something_with(data)". The problem with the code above is that if an
exception occurs in form.load() or form.showForm() etc. you end up with
an endless loop.
So I would rather catch the exception inside the "do_xxx" method (or
handle error codes in a more graceful way than just catching exceptions).
Although I suggest to improve the code, I fear that this is not the
cause of your problem. My guess is still a class loader issue: you might
end up with different libs being used in Jetty.
Carsten
--
Carsten Ziegeler
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]