JSP库文件的引用地址

新项目看到jsp页面引入库文件是这样写的
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="/struts-tags" prefix="s" %>

大感不惑,之前的jsp页面引入各种库文件,都是把tld文件拷到web-info文件夹下

查了才发现,新写法的原因是:
举例<%@ taglib uri="/struts-tags" prefix="s" %>说明

/struts-tags 是struts标签库,它在/struts2-core-2.1.8.jar/META-INF/struts-tags.tld文件中定义


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd">
<description><![CDATA["To make it easier to access dynamic data;
the Apache Struts framework includes a library of custom tags.
The tags interact with the framework's validation and internationalization features;
to ensure that input is correct and output is localized.
The Struts Tags can be used with JSP FreeMarker or Velocity."]]></description>
<display-name>"Struts Tags"</display-name>
<tlib-version>2.2.3</tlib-version>
<short-name>s</short-name>
<uri>/struts-tags</uri>


我们引用时取的就是uri标签中的值.
因为Tomcat等Web服务器会自动加载所有jar文件下的META-INF子目录下的.tld标记定义文件,这也是为什么好多框架不需要把tld文件复制到WEB-INF。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值