Package org.apache.taglibs.standard.lang.jstl

Examples of org.apache.taglibs.standard.lang.jstl.Evaluator


    @Override
    protected void setUp() throws Exception {
        super.setUp();
        context = createTestContext();
        e = new Evaluator();
    }
View Full Code Here


    public void testFunctions() throws Exception {

        System.setProperty("javax.servlet.jsp.functions.allowed", "true");
        Map m = getSampleMethodMap();
        Evaluator e = new Evaluator();
        Object o;

        o = e.evaluate("", "4", Integer.class, null, null, m, "foo");
        assertEquals("4", o.toString());
        o = e.evaluate("", "${4}", Integer.class, null, null, m, "foo");
        assertEquals("4", o.toString());
        o = e.evaluate("", "${2+2}", Integer.class, null, null, m, "foo");
        assertEquals("4", o.toString());
        o = e.evaluate("", "${foo:add(2, 3)}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());
        o = e.evaluate("", "${foo:multiply(2, 3)}", Integer.class, null, null, m, "foo");
        assertEquals("6", o.toString());
        o = e.evaluate("", "${add(2, 3)}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());
        o = e.evaluate("", "${multiply(2, 3)}", Integer.class, null, null, m, "foo");
        assertEquals("6", o.toString());
        o = e.evaluate("", "${add(2, 3) + 5}", Integer.class, null, null, m, "foo");
        assertEquals("10", o.toString());


        o = e.evaluate("", "${getInt(getInteger(getInt(5)))}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());

        o = e.evaluate("", "${getInteger(getInt(getInteger(5)))}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());

        o = e.evaluate("", "${getInt(getInt(getInt(5)))}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());

        o = e.evaluate("", "${getInteger(getInteger(getInteger(5)))}", Integer.class, null, null, m, "foo");
        assertEquals("5", o.toString());
    }
View Full Code Here

  pOut.println ("Expression: " + str);

  try {
    Class cl = parseClassName (typeStr);
    pOut.println ("ExpectedType: " + cl);
    Evaluator e = new Evaluator ();
    Object val = e.evaluate ("test", str, cl, null, context);
    pOut.println ("Evaluates to: " + val);
    if (val != null) {
      pOut.println ("With type: " + val.getClass ().getName ());
    }
    pOut.println ();
View Full Code Here

public class StaticFunctionTests {

  public static void main(String args[]) throws Exception {
    Map m = getSampleMethodMap();
    Evaluator e = new Evaluator();
    Object o;
    o = e.evaluate("", "4", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${4}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${2+2}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3) + 5}", Integer.class, null, null, m, "foo");
    System.out.println(o);

    System.out.println("---");
    o = e.evaluate("", "${getInt(getInteger(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInt(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInt(getInt(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInteger(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);

  }
View Full Code Here

  pOut.println ("Expression: " + str);

  try {
    Class cl = parseClassName (typeStr);
    pOut.println ("ExpectedType: " + cl);
    Evaluator e = new Evaluator ();
    Object val = e.evaluate ("test", str, cl, null, context);
    pOut.println ("Evaluates to: " + val);
    if (val != null) {
      pOut.println ("With type: " + val.getClass ().getName ());
    }
    pOut.println ();
View Full Code Here

public class StaticFunctionTests {

  public static void main(String args[]) throws Exception {
    Map m = getSampleMethodMap();
    Evaluator e = new Evaluator();
    Object o;
    o = e.evaluate("", "4", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${4}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${2+2}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3) + 5}", Integer.class, null, null, m, "foo");
    System.out.println(o);

    System.out.println("---");
    o = e.evaluate("", "${getInt(getInteger(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInt(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInt(getInt(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInteger(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);

  }
View Full Code Here

  pOut.println ("Expression: " + str);

  try {
    Class cl = parseClassName (typeStr);
    pOut.println ("ExpectedType: " + cl);
    Evaluator e = new Evaluator ();
    Object val = e.evaluate ("test", str, cl, null, context);
    pOut.println ("Evaluates to: " + val);
    if (val != null) {
      pOut.println ("With type: " + val.getClass ().getName ());
    }
    pOut.println ();
View Full Code Here

public class StaticFunctionTests {

  public static void main(String args[]) throws Exception {
    Map m = getSampleMethodMap();
    Evaluator e = new Evaluator();
    Object o;
    o = e.evaluate("", "4", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${4}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${2+2}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3) + 5}", Integer.class, null, null, m, "foo");
    System.out.println(o);

    System.out.println("---");
    o = e.evaluate("", "${getInt(getInteger(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInt(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInt(getInt(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInteger(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);

  }
View Full Code Here

  pOut.println ("Expression: " + str);

  try {
    Class cl = parseClassName (typeStr);
    pOut.println ("ExpectedType: " + cl);
    Evaluator e = new Evaluator ();
    Object val = e.evaluate ("test", str, cl, null, context);
    pOut.println ("Evaluates to: " + val);
    if (val != null) {
      pOut.println ("With type: " + val.getClass ().getName ());
    }
    pOut.println ();
View Full Code Here

public class StaticFunctionTests {

  public static void main(String args[]) throws Exception {
    Map m = getSampleMethodMap();
    Evaluator e = new Evaluator();
    Object o;
    o = e.evaluate("", "4", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${4}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${2+2}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${foo:multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${multiply(2, 3)}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${add(2, 3) + 5}", Integer.class, null, null, m, "foo");
    System.out.println(o);

    System.out.println("---");
    o = e.evaluate("", "${getInt(getInteger(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInt(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInt(getInt(getInt(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);
    o = e.evaluate("", "${getInteger(getInteger(getInteger(5)))}", Integer.class, null, null, m, "foo");
    System.out.println(o);

  }
View Full Code Here

TOP

Related Classes of org.apache.taglibs.standard.lang.jstl.Evaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.