当前位置: 首页>>代码示例>>Java>>正文


Java Node.render方法代码示例

本文整理汇总了Java中org.apache.velocity.runtime.parser.node.Node.render方法的典型用法代码示例。如果您正苦于以下问题:Java Node.render方法的具体用法?Java Node.render怎么用?Java Node.render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.velocity.runtime.parser.node.Node的用法示例。


在下文中一共展示了Node.render方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter ctx, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
    // get the bean
    ValueStack stack = (ValueStack) ctx.get("stack");
    HttpServletRequest req = (HttpServletRequest) stack.getContext().get(ServletActionContext.HTTP_REQUEST);
    HttpServletResponse res = (HttpServletResponse) stack.getContext().get(ServletActionContext.HTTP_RESPONSE);
    Component bean = getBean(stack, req, res);
    Container container = (Container) stack.getContext().get(ActionContext.CONTAINER);
    container.inject(bean);
    // get the parameters
    Map params = createPropertyMap(ctx, node);
    bean.copyParams(params);
    //bean.addAllParameters(params);
    bean.start(writer);

    if (getType() == BLOCK) {
        Node body = node.jjtGetChild(node.jjtGetNumChildren() - 1);
        body.render(ctx, writer);
    }

    bean.end(writer, "");
    return true;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:23,代码来源:AbstractDirective.java

示例2: render

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
	Object value = node.jjtGetChild(0).value(context);
	
	boolean isEmpty = false ;
	if(value == null){
		isEmpty = true ;
	}else{
		if(value instanceof String){
			isEmpty = StringUtil.isEmpty((String) value) ;
		}else if(value instanceof Collection){
			isEmpty = ((Collection) value).isEmpty() ;
		}else if(value.getClass().isArray()){
			isEmpty = Array.getLength(value) > 0 ;
		}
	}
	
       if (isEmpty) {
           Node content = node.jjtGetChild(1);
           content.render(context, writer);
       }
       
       return true;
}
 
开发者ID:ryanwli,项目名称:guzz,代码行数:24,代码来源:IsEmptyDirective.java

示例3: render

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
	Object value = node.jjtGetChild(0).value(context);

	
	boolean isEmpty = false ;
	if(value == null){
		isEmpty = true ;
	}else{
		if(value instanceof String){
			isEmpty = StringUtil.isEmpty((String) value) ;
		}else if(value instanceof Collection){
			isEmpty = ((Collection) value).isEmpty() ;
		}else if(value.getClass().isArray()){
			isEmpty = Array.getLength(value) > 0 ;
		}
	}
	if (!isEmpty) {
           Node content = node.jjtGetChild(1);
           content.render(context, writer);
       }
       
       return true;
}
 
开发者ID:ryanwli,项目名称:guzz,代码行数:24,代码来源:NotEmptyDirective.java

示例4: render

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
@Override
public boolean render(InternalContextAdapter context, Writer writer,
		Node node) throws IOException, ResourceNotFoundException,
		ParseErrorException, MethodInvocationException {
	Node bodyNode = getBodyNode(context, node);
	if (AsynchronousContain.isAsyncConext()) {
		StringWriter sw = new StringWriter();
		bodyNode.render(context, sw);
		PipelineTask task = (PipelineTask) context
				.get(PipelineTask.ATTR_KEY);
		task.addJsCode(sw.toString());
	} else {
		writer.write("<script type=\"text/javascript\">\r\n");
		bodyNode.render(context, writer);
		writer.write("</script>\r\n");
	}
	return true;
}
 
开发者ID:xiyelife,项目名称:jresplus,代码行数:19,代码来源:JsCodeDirective.java

示例5: getParams

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
@Override
protected Params getParams(InternalContextAdapter context, Node node) throws IOException {
  final Params params = new Params();
  params.setPrefix("WHERE");
  params.setPrefixOverrides("AND |OR |AND\n|OR\n|AND\r|OR\r");
  if (node.jjtGetNumChildren() == 1) {
    final Node child = node.jjtGetChild(0);
    if (child instanceof ASTBlock) {
      StringWriter blockContent = new StringWriter();
      child.render(context, blockContent);
      params.setBody(blockContent.toString().trim());
      return params;
    }
  }
  return null;
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:17,代码来源:WhereDirective.java

示例6: getParams

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
@Override
protected Params getParams(InternalContextAdapter context, Node node) throws IOException {
  final Params params = new Params();
  params.setPrefix("SET");
  params.setSuffixOverrides(",");
  if (node.jjtGetNumChildren() == 1) {
    final Node child = node.jjtGetChild(0);
    if (child instanceof ASTBlock) {
      StringWriter blockContent = new StringWriter();
      child.render(context, blockContent);
      params.setBody(blockContent.toString().trim());
      return params;
    }
  }
  return null;
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:17,代码来源:SetDirective.java

示例7: getParams

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
protected Params getParams(final InternalContextAdapter context, final Node node) throws IOException,
        ResourceNotFoundException, ParseErrorException, MethodInvocationException {
    final Params params = new Params();
    final int nodes = node.jjtGetNumChildren();
    for (int i = 0; i < nodes; i++) {
        Node child = node.jjtGetChild(i);
        if (child != null) {
            if (!(child instanceof ASTBlock)) {
                if (i == 0) {
                    params.setPrefix(String.valueOf(child.value(context)));
                } else if (i == 1) {
                    params.setPrefixOverrides(String.valueOf(child.value(context)).toUpperCase(Locale.ENGLISH));
                } else if (i == 2) {
                    params.setSuffix(String.valueOf(child.value(context)));
                } else if (i == 3) {
                    params.setSuffixOverrides(String.valueOf(child.value(context)).toUpperCase(Locale.ENGLISH));
                } else {
                    break;
                }
            } else {
                StringWriter blockContent = new StringWriter();
                child.render(context, blockContent);
                if ("".equals(blockContent.toString().trim())) {
                    return null;
                }
                params.setBody(blockContent.toString().trim());
                break;
            }
        }
    }
    return params;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:33,代码来源:TrimExtDirective.java

示例8: getParams

import org.apache.velocity.runtime.parser.node.Node; //导入方法依赖的package包/类
protected Params getParams(final InternalContextAdapter context, final Node node) throws IOException {
  final Params params = new Params();
  final int nodes = node.jjtGetNumChildren();
  for (int i = 0; i < nodes; i++) {
    Node child = node.jjtGetChild(i);
    if (child != null) {
      if (!(child instanceof ASTBlock)) {
        if (i == 0) {
          params.setPrefix(String.valueOf(child.value(context)));
        }
        else if (i == 1) {
          params.setPrefixOverrides(String.valueOf(child.value(context)).toUpperCase(Locale.ENGLISH));
        }
        else if (i == 2) {
          params.setSuffix(String.valueOf(child.value(context)));
        }
        else if (i == 3) {
          params.setSuffixOverrides(String.valueOf(child.value(context)).toUpperCase(Locale.ENGLISH));
        }
        else {
          break;
        }
      }
      else {
        StringWriter blockContent = new StringWriter();
        child.render(context, blockContent);
        params.setBody(blockContent.toString().trim());
        break;
      }
    }
  }
  return params;
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:34,代码来源:TrimDirective.java


注:本文中的org.apache.velocity.runtime.parser.node.Node.render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。