You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Lowe <me...@gmail.com> on 2005/02/17 11:54:13 UTC

Flowscript switch statement

I imagine that everyone's been too busy developing apps at the speed
of light, on the rapid application development framework known as
cocoon, to have noticed that switch statements don't work with
flowscript, at least when testing strings.

var foo = "bar";

switch(foo) {
  case "bar" : print("switch works"); break;
  default : print("this is a rancid crock of poo");break;
} 

Please tell me I'm missing something and cocoon is the best thing
since sliced bread.

Mark

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


Re: Flowscript switch statement

Posted by Reinhard Poetz <re...@apache.org>.
Mark Lowe wrote:

> 
> OT.. Can you give me a straight answer on the issue of localized
> required messages just plainly not working?

Sorry, I don't have the time today to follow your i18n thread :-(


-- 
Reinhard Pötz           Independant Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

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


Re: Flowscript switch statement

Posted by Mark Lowe <me...@gmail.com>.
Hi Reinhard

What leaps and bounds eh, switch statement support. I'll see if
swapping rhino out works with no shadiness.

OT.. Can you give me a straight answer on the issue of localized
required messages just plainly not working?

Mark


On Thu, 17 Feb 2005 18:01:58 +0100, Reinhard Poetz <re...@apache.org> wrote:
> Mark Lowe wrote:
> > I imagine that everyone's been too busy developing apps at the speed
> > of light, on the rapid application development framework known as
> > cocoon, to have noticed that switch statements don't work with
> > flowscript, at least when testing strings.
> >
> > var foo = "bar";
> >
> > switch(foo) {
> >   case "bar" : print("switch works"); break;
> >   default : print("this is a rancid crock of poo");break;
> > }
> >
> > Please tell me I'm missing something and cocoon is the best thing
> > since sliced bread.
> 
> In 2.2 it is working as expected. You could use the Rhino version of 2.2 and
> replace the version available in 2.1 as it should be binary compatible.
> 
> --
> Reinhard Pötz           Independant Consultant, Trainer & (IT)-Coach
> 
> {Software Engineering, Open Source, Web Applications, Apache Cocoon}
> 
>                                        web(log): http://www.poetz.cc
> --------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: Flowscript switch statement

Posted by Reinhard Poetz <re...@apache.org>.
Mark Lowe wrote:
> I imagine that everyone's been too busy developing apps at the speed
> of light, on the rapid application development framework known as
> cocoon, to have noticed that switch statements don't work with
> flowscript, at least when testing strings.
> 
> var foo = "bar";
> 
> switch(foo) {
>   case "bar" : print("switch works"); break;
>   default : print("this is a rancid crock of poo");break;
> } 
> 
> Please tell me I'm missing something and cocoon is the best thing
> since sliced bread.

In 2.2 it is working as expected. You could use the Rhino version of 2.2 and 
replace the version available in 2.1 as it should be binary compatible.

-- 
Reinhard Pötz           Independant Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

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


Yet another JXTemplate Beatle???

Posted by oceatoon <t....@systheo.com>.
Hi every one 

I have been using this since a while in many different situations:
<jx:set var="langlist" value="en,fr,de,es"/>
<jx:forEach var="langitem" items="${java.util.StringTokenizer( langlist ,
',' )}">
${langitem}
</jx:forEach>

Not very complicated, hey ;-)

Today I wanted to make my CForms model a bit dynamic:
so in Flow I call  
var form = new Form("cocoon:/forms/masterform_model");

my pipeline is as simple as this
<map:match pattern="forms/masterform_model">
  <map:generate type="jx" src="forms/masterform_model.xml"/>
  <map:serialize type="xml"/>
</map:match>

and in my model I use the above JX code , for the first time the
${java.util.StringTokenizer( langlist , ',' )} returns nothing??? therefore
the forEach either,  I manage to get the forEach to work with a
begin-end-step structure but I have no idea in this use case why it doesn't
feel like working??

Am I missing something or should this go down the JxTemplate BugBox?
Regards
Tibor





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


Re: Flowscript switch statement

Posted by Mark Lowe <me...@gmail.com>.
Least it wasn't that I'd forgotten how to write a trusty switch
statement then :o)

I've used a dirty

foo = "bar"?print("Mellow world"):null;

Mark

On Thu, 17 Feb 2005 13:26:55 +0100, Jan Hinzmann <ja...@geeksonly.de> wrote:
> i realised that too, and therefore am using if-else combinations now.
> 
> I think having the switch-statement working with strings depends on the
> javascript-distribution.
> 
> In java itself, you cannot "switch over strings",  but you can define constants
> and switch over them.
> 
> var MY_CONSTANT1 = 1;
> var MY_CONSTANT2 = 2;
> ...
> 
> var foo = MY_CONSTANT1;
> 
> switch(foo) {
> case MY_CONSTANT1 : print("introducing a indirectionlayer");break;
> 
> case MY_CONSTANT2 : print("solves most problems in computerscience");break;
> 
> default : print("some default answer");
> }
> 
> Mark Lowe wrote:
> > I imagine that everyone's been too busy developing apps at the speed
> > of light, on the rapid application development framework known as
> > cocoon, to have noticed that switch statements don't work with
> > flowscript, at least when testing strings.
> >
> > var foo = "bar";
> >
> > switch(foo) {
> >   case "bar" : print("switch works"); break;
> >   default : print("this is a rancid crock of poo");break;
> > }
> >
> > Please tell me I'm missing something and cocoon is the best thing
> > since sliced bread.
> >
> > Mark
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> 
> --
> Gruss, Jan Hinzmann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: Flowscript switch statement

Posted by Jan Hinzmann <ja...@geeksonly.de>.
i realised that too, and therefore am using if-else combinations now.

I think having the switch-statement working with strings depends on the 
javascript-distribution.

In java itself, you cannot "switch over strings",  but you can define constants 
and switch over them.

var MY_CONSTANT1 = 1;
var MY_CONSTANT2 = 2;
...

var foo = MY_CONSTANT1;

switch(foo) {
case MY_CONSTANT1 : print("introducing a indirectionlayer");break;

case MY_CONSTANT2 : print("solves most problems in computerscience");break;

default : print("some default answer");
}

Mark Lowe wrote:
> I imagine that everyone's been too busy developing apps at the speed
> of light, on the rapid application development framework known as
> cocoon, to have noticed that switch statements don't work with
> flowscript, at least when testing strings.
> 
> var foo = "bar";
> 
> switch(foo) {
>   case "bar" : print("switch works"); break;
>   default : print("this is a rancid crock of poo");break;
> } 
> 
> Please tell me I'm missing something and cocoon is the best thing
> since sliced bread.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Gruss, Jan Hinzmann

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