zoukankan      html  css  js  c++  java
  • jstl标签在xml中声明

    <jsp-config>
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/fmt.tld</taglib-location>
    </taglib>

    <taglib>
    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
    <taglib-location>/WEB-INF/sql.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
    <taglib-location>/WEB-INF/x.tld</taglib-location>
    </taglib>
    </jsp-config>

    <jsp-config>在xml版本高于2.5使用

    1.下载jakarta-taglibs-standard-1.1.2.zip(在Weblogic中必须下载1.0版http://jakarta.apache.org/site/downloads/downloads_taglibs-standard-1.0.cgi)
    2.解压后,将standard.jar和jstl.jar文件拷贝到WEB-INFlib
    3.将jakarta-taglibs-standard-1.1.1 ld下的tld类型文件拷到"WEB-INF lds"下(1.1是15个文件,1.0是8个)
    4.在WEB-INF下建立web.xml文件:(以下<taglib>定义是针对1.0的)
      <?xml version="1.0" encoding="ISO-8859-1"?>

    <web-app 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-app_2_4.xsd"
        version="2.4">
     
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
        <taglib-location>/WEB-INF/tlds/fmt-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
        <taglib-location>/WEB-INF/tlds/c-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
        <taglib-location>/WEB-INF/tlds/sql.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
        <taglib-location>/WEB-INF/tlds/sql-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
        <taglib-location>/WEB-INF/tlds/x.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
        <taglib-location>/WEB-INF/tlds/x-rt.tld</taglib-location>
    </taglib>
    </web-app>

    建立一个名为test.jsp文件
    <%@   page   isELIgnored="false"  %>Tomcat中必须加这行,因为,默认jsp是不支持EL的.Weblogic中不能加,加了会出错! 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page contentType="text/html;charset=GB2312" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <html>
    <head>
    <title>测试你的第一个使用到JSTL 的网页</title>
    </head>
    <body>
    <c:out value="欢迎测试你的第一个使用到JSTL 的网页"/>
    </br>你使用的浏览器是:</br>
    <c:out value="${header['User-Agent']}"/>
    <c:set var="a" value="David O'Davies" />
    <c:out value="David O'Davies" escapeXml="true"/>
    </body>
    </html>

  • 相关阅读:
    Linux使用Public Key方式远程登录
    Linux编译安装Mariadb数据库
    Centos7环境搭建lnmp环境
    浅谈Java中的System.gc()的工作原理
    Eclipse快捷键大全(转载)
    java中的参数传递——值传递、引用传递
    Visual Studio 2017 安装后无法创建c++或MFC项目
    ubuntu sendmail配置发送邮件
    ubuntu11.0静态IP地址配置
    cin与cout详解
  • 原文地址:https://www.cnblogs.com/jerry123/p/6974204.html
Copyright © 2011-2022 走看看