cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: Can't use switch with cocoon.request.get in flowscript
Date Mon, 08 Feb 2010 16:27:11 GMT
Well,

I know for sure the switch works fine in cocoon2.2.  Might not be implemented properly in
an older version of Rhino?

Anyway...

What happens if you use this snippet??  It should at least print something to your console.

     var cmd = cocoon.request.get("Cmd");
     print("cmd='" + cmd = "'");

     switch (cmd) {
        case "Open": 
            {
                print("Command is Open");
                break;
            }
        case "Create Model": 
            {
                print("Command is Create Model");
                break;   
            }
       ...
       Case default:
            {
                print("Command did not match any of the above");
                break;   
            }
     }

Kind regards,
Robby Pelssers
    


-----Original Message-----
From: Schmitz, Jeffrey A [mailto:Jeffrey.A.Schmitz@boeing.com] 
Sent: Monday, February 08, 2010 4:55 PM
To: users@cocoon.apache.org
Subject: Can't use switch with cocoon.request.get in flowscript

Hello,
   In Cocoonn 2.1, does anyone know why I can't use a switch command with the result of cocoon.request.get
in flowscript?  if's work just fine, but switch doesn't.  E.g. to get the switch to work I
have to do the following:

     var cmd = cocoon.request.get("Cmd");

     //For some reason, the switch doesn't work with the
     //string returned from cocoon.request.get, but if
     //statements do.
     if (cmd == "Open") {
        cmd = "Open";
     }
     if (cmd == "Create Model") {
        cmd = "Create Model";
     }
     if (cmd == "Account") {
         cmd = "Account";
      }
     if (cmd == "Logout") {
        cmd = "Logout";
     }

     switch (cmd) {

        case "Open":
                  ...

I have tried adding .toString() to the end of the get function and also the cmd variable in
various places, but that doesn't work either.

Thanks!
Jeff




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

Mime
View raw message