Rules are supposed to be declarative in nature. You should never need to add control statements, neither to the LHS ("when"), nor to the RHS ("then"), although, the RHS being a java code block allows you to do it... but it is usually code smell...

   Think about what you are doing and check if you are not trying to use drools as a scripting language...

   Following may help:


2007/5/23, Rajesh.Sachin10 < >:

We can write the Java functions in [then] condition of the dsl file.

Is it possible to write JAVA functions / JAVA kind of coding in the [when]
condition of dsl file?

eg: [when] for(int i = 0; i < 3; i++) {  System.out.println(i);  }
      [then] Log "{message}"
View this message in context:
Sent from the drools - user mailing list archive at

rules-users mailing list

  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @