Date: 2004-09-12T22:51:01
Editor: BertrandDelacretaz <[EMAIL PROTECTED]>
Wiki: Cocoon Wiki
Page: FAQs
URL: http://wiki.apache.org/cocoon/FAQs
Added: How to use Flowscript without creating sessions?
Change Log:
------------------------------------------------------------------------------
@@ -290,3 +290,31 @@
A: Do you serialize it to JPG or PNG? Otherwise this error can not occur. But
if, it's of course no longer SVG. The reason for the error is then invalid SVG
code or even invalid XML. The conversion to JPG or PNG fails. More details
should be found in the logs.
+=== Q: How to use Flowscript without creating sessions? ===
+{{{FOM_JavaScriptInterpeter}}} creates a session (if it doesn't already exist)
whenever a variable is set in the global scope.
+
+Note that variables declared inside functions must be declared with ''var'' to
be considered locals.
+
+For example, this causes a session to be created:
+{{{
+function public_XXX() {
+ rt = "dummy"; // huh - is that a global?
+ cocoon.sendPage("RRR");
+}
+}}}
+
+Whereas this does not:
+{{{
+function public_XXX() {
+ var rt = "dummy";
+ cocoon.sendPage("RRR");
+}
+}}}
+
+More info in the javascript docs:
+
+*
[http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/ident.html#1009822]
+
+*
[http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/stmt.html#1066604]
+
+Thanks SylvainWallez for the clarification!