1、關于JSP標簽的好處就不再羅嗦
數據字典就是使用的下拉框,只要定義使用那個字典就會將這個字典可用的內容顯示出來
顯示字典時只要定義那個字典和屬性值就可以顯示出字典的顯示值
2、首先在web.xml中定義自定義標簽加載的引用,兩個屬性分別是引用的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中定義自己的標簽,數據字典應用的話我們需要一個標簽庫,三個標簽。分別是,select標簽,options標簽,和現實數據字典的標簽,每個標簽都對應不同的實現類
<?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><!-- 標簽庫版本 --> <jsp-version>1.2</jsp-version> <!-- 標簽庫要求的JSP規范版本 --> &
nbsp; <short-name>html</short-name> <!-- JSP頁面編寫工具可以用來創建助記名的可選名字 -->
新聞熱點
疑難解答