关于jsptag中teiclass的使用

//ListAllBodyTagExtraInfo.java
public class ListAllBodyTagExtraInfo extends TagExtraInfo {
public ListAllBodyTagExtraInfo() { }
/**
* 让JSP引擎确定参数类型
*/
public VariableInfo[] getVariableInfo(TagData data) {
 return new VariableInfo[] {
 /**
 * 参数名,类型,是否声明新变量,范围
 * 范围取值:AT_BEGIN,AT_END,NESTED(标记有效范围内)
 */
  new VariableInfo("name", "java.lang.String", true, VariableInfo.NESTED) ,
  new VariableInfo("value", "java.lang.Integer", true, VariableInfo.NESTED),
 };
}
}
定义该函数后,声明正确的tld,可以这么使用

<definetag attr1="value">
<%=name%>is <%=value%>
</definetag>

VariableInfo
public VariableInfo(java.lang.String varName,
                    java.lang.String className,
                    boolean declare,
                    int scope)
Constructor These objects can be created (at translation time) by the TagExtraInfo instances.
参数:
varName - The name of the scripting variable
className - The type of this variable
declare - If true, it is a new variable (in some languages this will require a declaration)
scope - Indication on the lexical scope of the variable

字段摘要

static int
AT_BEGIN
          Scope information that scripting variable is visible after start tag.

static int
AT_END
          Scope information that scripting variable is visible after end tag.

static int
NESTED
          Scope information that scripting variable is visible only within the start/end tags.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值