示例#1
0
  @Test
  public void testWithoutResource() throws Exception {
    String template =
        "<%@ taglib prefix='res' uri='http://www.unidal.org/webres' %>"
            + //
            "<res:bean id='res'/>Hello, ${name}! Nice to meet ${you}!";
    String expected = "Hello, world! Nice to meet robert!";
    ITemplateRef ref =
        TemplateFactory.forRef().createInlineRef("/testWithoutResource.jsp", template);

    checkTemplate(ref, expected, "name", "world", "you", "robert");
  }
示例#2
0
  @Test
  public void testWithResource() throws Exception {
    String template =
        "<%@ taglib prefix='res' uri='http://www.unidal.org/webres' %>"
            + //
            "<res:bean id='res'/>Hello, <res:img value='${res.img.shared.simple_svg}'/>!"
            + //
            "${res.img.local.eBayLogo_gif} and ${res.img.shared.eBayLogo_gif}!";
    String expected =
        "Hello, <img src=\"/test/f/img/shared/simple.svg\" width=\"467\" height=\"462\">!"
            + //
            "/test/img/eBayLogo.gif and /test/f/img/shared/eBayLogo.gif!";
    ITemplateRef ref = TemplateFactory.forRef().createInlineRef("/testWithResource1.jsp", template);

    checkTemplate(ref, expected);
  }
示例#3
0
  protected void checkTemplate(String source, String expected, Object... pairs) throws Exception {
    ITemplateRef templateRef = TemplateFactory.forRef().createInlineRef(source);

    checkTemplate(templateRef, expected, pairs);
  }