国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JSP > 正文

JSP自定義標(biāo)簽實(shí)現(xiàn) 數(shù)據(jù)字典

2019-11-02 14:27:38
字體:
供稿:網(wǎng)友

  1、關(guān)于JSP標(biāo)簽的好處就不再羅嗦

數(shù)據(jù)字典就是使用的下拉框,只要定義使用那個(gè)字典就會(huì)將這個(gè)字典可用的內(nèi)容顯示出來

顯示字典時(shí)只要定義那個(gè)字典和屬性值就可以顯示出字典的顯示值

 

       2、首先在web.xml中定義自定義標(biāo)簽加載的引用,兩個(gè)屬性分別是引用的URI和加載路徑

<?xml version="1.0" encoding="UTF-8"?>    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">        <welcome-file-list>            <welcome-file>index.jsp</welcome-file>        </welcome-file-list>        <jsp-config>            <taglib>                <taglib-uri>/tld/web-html</taglib-uri>                <taglib-location>                    /WEB-INF/tlds/web-html.tld                </taglib-location>            </taglib>        </jsp-config>    </web-app>   

    3、在web-html.tld中定義自己的標(biāo)簽,數(shù)據(jù)字典應(yīng)用的話我們需要一個(gè)標(biāo)簽庫,三個(gè)標(biāo)簽。分別是,select標(biāo)簽,options標(biāo)簽,和現(xiàn)實(shí)數(shù)據(jù)字典的標(biāo)簽,每個(gè)標(biāo)簽都對(duì)應(yīng)不同的實(shí)現(xiàn)類

<?xml version="1.0" encoding="UTF-8"?>    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"          "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">    <taglib>        <tlib-version>1.0</tlib-version><!-- 標(biāo)簽庫版本 -->        <jsp-version>1.2</jsp-version>  <!-- 標(biāo)簽庫要求的JSP規(guī)范版本 -->      &


nbsp; <short-name>html</short-name>   <!-- JSP頁面編寫工具可以用來創(chuàng)建助記名的可選名字 -->    

    <tag>             <name>select</name>             <tag-class>com.SelectTag</tag-class>             <body-content>JSP</body-content>             <attribute>                 <name>name</name>                 <rtexprvalue>true</rtexprvalue>             </attribute>             <attribute>                 <name>style</name>                 <rtexprvalue>true</rtexprvalue>             </attribute>         </tag>         <tag>             <name>options</name>             <tag-class>com.OptionsTag</tag-class>             <body-content>JSP</body-content>             <attribute>                 <name>collection</name>                 <rtexprvalue>true</rtexprvalue>             </attribute>         </tag>         <tag>             <name>selectDisplay</name>             <tag-class>com.SelectDisplay</tag-class>             <
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 青田县| 延寿县| 霍州市| 呼和浩特市| 梅州市| 崇信县| 长治市| 玛纳斯县| 鹤岗市| 丹寨县| 洛宁县| SHOW| 吉安市| 明星| 余姚市| 新丰县| 澎湖县| 金华市| 舒兰市| 宜兴市| 平舆县| 历史| 格尔木市| 收藏| 平南县| 景德镇市| 舒兰市| 蓝山县| 甘南县| 隆安县| 元江| 海伦市| 那坡县| 阿克陶县| 锡林郭勒盟| 华蓥市| 涡阳县| 清原| 如皋市| 洱源县| 东丰县|