コード例 #1
0
  public void testPutInsert2()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {

    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "/pages");
    String page =
        "<pager:put key=\"put-content\"><pager:insert page=\"insert3.xhtml\"/></pager:put>"
            + "<pager:echo>put-content:[${put-content}]</pager:echo>";

    Action action = new Action("/pages", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    String s = execContext.getString("put-content");
    assertEquals("content of insert3.html", s);
    assertEquals("put-content:[content of insert3.html]", newPage);
  }
コード例 #2
0
  public void testPutInsert()
      throws IOException, NestedActionException, ClassNotFoundException, InstantiationException,
          IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          BadXMLException {
    URL url = ResourceUtils.class.getResource("/pages");
    Validate.notNull(url, "Resource [" + "/pages" + "] not found");

    // log.warn("url.path:" + url.getPath());
    // log.warn("url.file:" + url.getFile());
    execContext.put(ActionConst.WEB_REAL_PATH_BEAN_REF, "/pages");
    String page =
        "<pager:put key=\"put-content\"><pager:insert page=\"insert3.xhtml\"/></pager:put>"
            + "<pager:echo>put-content:${put-content}</pager:echo>";

    Action action = new Action("", "", ActionConst.DEFAULT_PAGER_NAMESPACE);
    String newPage = action.processPage(execContext, page);
    String s = execContext.getString("put-content");
    assertEquals("content of insert3.html", s);
    assertEquals("put-content:content of insert3.html", newPage);
  }