JSP学习笔记6

Custom Tag Library

Simple Tag

javax.servlet.jsp.tagext.SimpleTag接口提供以下方法:

setJspContext() Makes the JspContext available for tag processing

setParent() Called by the web container to make the parent tag available

setJspBody() Makes the body content available for tag processing

doTag() Called by the container to begin SimpleTag operation

getParent() Called by the Java class to obtain its parent JspTag

 

javax.servlet.jsp.tagext.SimpleTagSupport类别implements SimpleTag 所有方法,并提供以下方法:

getJspContext() Returns the JspContext for processing in the tag

getJspBody() Returns the JspFragment object for body processing in the tag

findAncestorWithClass() Returns the ancestor tag with the specified class

 

javax.servlet.jsp.tagext.Tag接口提供以下方法:

void setPageContext(PageContext pc)

void setParent(Tag t)

Tag getParent()

int doStartTag() throws JspException

int doEndTag() throws JspException

void release()

javax.servlet.jsp.tagext.IterationTag接口extends Tag提供以下方法:

int doAfterBody() throws JspException

javax.servlet.jsp.tagext.BodyTag接口extends IterationTag提供以下方法:

void setBodyContent(BodyContent bc)

void doInitBody() throws JspException

javax.servlet.jsp.tagext.TagSupport类别implements IterationTag提供以下方法:

static Tag findAncestorWithClass(Tag from , java.lang.Class class)

javax.servlet.jsp.tagext.BodyTagSupport类别extends TagSupport implements BodyTag提供以下方法:

JspWriter getPreviousOut()

BodyContent getBodyContent()

===========================================================================

标签类库描述文件(Tag Library Descriptor简称TLD)

<taglib>元素定义标签类库相关信息,其子元素如下:

<tlib-version>标签库版本</tlib-version>

<jsp-version>JSP版本</jsp-version>

<short-name>定义一个简短的名称</short-name>

<uri>标签库所对应的URI信息</uri>

<tag>标签库所包含的自订标签,可定义多个

       <name>自订标签名称</name>

       <tag-class>自订标签所对应的Tag Handler Class</tag-class>

       <body-content>标签主体的种类 empty , JSP , tagdependent , scriptless</body-content>

       <description>说明</description>

       <attribute>定义属性,可定义多个

              <name>属性名称</name>

              <type>属性类型</type>

              <required>此属性是否为必要(true/false)</required>

              <rtexprvalue>属性值是否可以在JSP执行时期动态产生(true/false)</rtexprvalue>

       </attribute>

</tag>

 

 

 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值