サーバー側式評価を使用した 2 つの数値の比較

  1. クラスパスに <exm_root>/services/adobe-exm-expeval-services.jar を追加します。

  2. デフォルトの Spring コンテキストファイルは、adobe-exm-expeval-services.jar 内の /META-INF/spring/module-context.xml にあります。このファイルを使用して Spring コンテキストを作成します。

    ApplicationContext ctx = new ClassPathXmlApplicationContext("/META-INF/spring/module-context.xml");
  3. 式評価サービスを取得します。

    EXPEvaluator expressionEvaluationService = (EXPEvaluator) ctx.getBean("lc.exm.expEvaluator");
  4. 評価対象の式の内部で使用する変数のマップを作成します。

    HashMap<String, Serializable> variables = new HashMap<String, Serializable>(); 
    variables.put("number1", 25); 
    variables.put("number2", 26);
  5. 式評価サービスを起動し、パラメーターとして式と式変数を渡します。

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