类 GeneralVarTagBinding

java.lang.Object
org.beetl.core.tag.Tag
org.beetl.core.tag.GeneralVarTagBinding

public abstract class GeneralVarTagBinding extends Tag
此类子类将可以作为html 标签使用,除了能实现bindVars来初始化绑定的变量外,允许render方法里通过调用 方法bind(name,value) 来绑定变量,或者更常用的是binds(Object... array)如下是一个例子
 public class TestGeneralVarTagBinding extends GeneralVarTagBinding
 {


 public void render()
 {
 for (int i = 0; i < 5; i++)
 {
 this.bind("value", i);// or this.binds(i);
 this.doBodyRender();
 }

 }

 }

 
此例子会循环渲染标签体5次,并且每次循环都会设置value的值,如下是模板内容
 <#tag ; value>
 ${value}
 </#tag>
 
  • 构造器详细资料

    • GeneralVarTagBinding

      public GeneralVarTagBinding()
  • 方法详细资料

    • mapName2Index

      public void mapName2Index(LinkedHashMap<String,Integer> map)
    • binds

      protected void binds(Object... array)
      按照标签变量声明的顺序绑定
    • getAttributeValue

      public Object getAttributeValue(String attrName)
    • getHtmlTagName

      public String getHtmlTagName()
    • getAttributes

      public Map<String,Object> getAttributes()