if标签的自定义

来源:互联网 发布:李炎恢php怎么样 编辑:程序博客网 时间:2024/05/18 08:06
1)tld文件内容<tag>    <name>if</name>    <tag-class>defineLables.iftag</tag-class>    <body-content>scriptless</body-content>    <attribute>        <name>test</name>        <required>true</required>        <rtexprvalue>true</rtexprvalue>    </attribute>  </tag>2if标签处理器类public class iftag extends SimpleTagSupport{    private boolean test;    public void setTest(boolean test) {        this.test = test;    }    @Override    public void doTag() throws JspException, IOException {        if(test){            this.getJspBody().invoke(null);        }    }}3)jsp文件内容 <ctag:if test="true">        条件成立    </ctag:if>
0 0
原创粉丝点击