Compare two numbers using server-side expression evaluation

  1. Add <exm_root>/services/adobe-exm-expeval-services.jar to your classpath.

  2. The default Spring context file is available at /META-INF/spring/module-context.xml, inside adobe-exm-expeval-services.jar. Create a Spring context using this file.

    ApplicationContext ctx = new ClassPathXmlApplicationContext("/META-INF/spring/module-context.xml");
  3. Retrieve the expression evaluation service.

    EXPEvaluator expressionEvaluationService = (EXPEvaluator) ctx.getBean("lc.exm.expEvaluator");
  4. Create a map of the variables used inside the expression being evaluated.

    HashMap<String, Serializable> variables = new HashMap<String, Serializable>(); 
    variables.put("number1", 25); 
    variables.put("number2", 26);
  5. Start the expression evaluation service, and pass the expression and expression variables as parameters.

  6. Boolean result = (Boolean)expressionEvaluationService.evaluateExpression("${number2 > number1}",variables);

// Ethnio survey code removed