What is the uri in taglib prefix="s" uri="/struts-tags"?

This sentence <%@ taglib prefix="s" uri="/struts-tags" %> is to find the tag library from the address /struts-tags, which is defined in the Struts 2 library file struts2-core-2.0.11.jar inside the file META-INF/struts-tags.tld.

The file has this piece of code:

 

<?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>2.2.3</tlib-version>

<jsp-version>1.2</jsp-version>

<short-name>s</short-name>

<uri>/struts-tags</uri>

....

The bold italic <uri>/struts-tags</uri> just matches the uri attribute in the taglib declaration introduced by the JSP file, so that the corresponding tag definition location is found. Web servers such as Tomcat will automatically load the .tld tag definition files in the META-INF subdirectory under all jar files, which is why many frameworks do not need to copy the tld file to WEB-INF.

Reprinted from http://blog.sina.com.cn/s/blog_695ef5280100mamw.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326390408&siteId=291194637