zoukankan      html  css  js  c++  java
  • 自定义标签

    自定义标签   hello

      1.创建一个标签处理器类:实现SimpleTag 接口。

      2.在WEB-INF 文件夹下新建一个 .tld( )为扩展名的XML文件。并且写入国定的部分:并description,display-name,tlib-version,short-name,uri 做出修改

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
        version="2.0">
        
       <!-- 描述TID文件 -->
      <description>MyTag 1.0 core library</description>
      <display-name>MyTag core</display-name>
      <tlib-version>1.0</tlib-version>
      
      <!-- 建议在 jsp 页面使用的标签的前缀 -->
      <short-name>xiaoxi</short-name>
      <!-- 作为 tld 文件的id, 用来唯一标识当前的TLD 文件,多个TLD 文件url 不可重复  -->
      <uri>http://www.xiaoxi.com/mytag/core</uri>

    </taglib>

      3.在 tld文件中描述自定义的标签

       <!--描述自定义的 HelloSimpleTag 标签  --> 
        <tag>
        	<!-- 标签名 -->
        	<name>hello</name>
        	<!-- 标签所在的全类名  -->
        	<tag-class>cn.xiaoxi.tag.HelloSimpleTag</tag-class>
        	<!-- 标签体的类型 -->
        	<body-content>empty</body-content>
        </tag>
    

      4.在jsp页面使用自定义的标签

  • 相关阅读:
    asp.net mvc Bundle
    Nginx配置文件详细说明
    Nginx 负载均衡配置和策略
    WPF 体系结构
    理解WPF中的视觉树和逻辑树
    物料需求預估
    缓存ViewState减少网络传输
    xingfu
    如何在表格中插入图片
    add
  • 原文地址:https://www.cnblogs.com/wodebokezhijian/p/8150104.html
Copyright © 2011-2022 走看看