我是靠谱客的博主 烂漫柜子,这篇文章主要介绍if标签的自定义,现在分享给大家,希望可以做个参考。

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>

最后

以上就是烂漫柜子最近收集整理的关于if标签的自定义的全部内容,更多相关if标签内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部