可以在JSP中创建引用绝对路径的一个taglib,这样的话就不许要在WEB.XML中声明了。如:

<%@pagecontentType="text/html;charset=UTF-8"language="java"%><%@tagliburi="http://jakarta.apache.org/struts/tags-bean"prefix="bean"%><%@tagliburi="http://jakarta.apache.org/struts/tags-html"prefix="html"%><%@tagliburi="http://jakarta.apache.org/struts/tags-logic"prefix="logic"%><%@tagliburi="http://java.sun.com/jstl/core"prefix="c"%><%@tagliburi="http://java.sun.com/jstl/fmt"prefix="fmt"%>

<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN">

<!--starttaglib-->

<%@includefile="/includes/taglibs.inc.jsp"%>

<!--endtaglib-->

<html:html>

<body>

...

当你用绝对URL指定taglib时,你不需要将相应的taglib中加入到web.xml中去。

Servlet2.3之前必须在web.xml中声明taglib从2.3开始才可以使用绝URI。绝对URI是由相应的TLD文件确定的。

如果你想在整个应用程序中使用同一个talib库,可以创建一个包含taglib的文件,然后将此文件包含到任意的JSP页面中去。

struts1.1和struts1.2中的taglib是有区别的

TaglibraryStruts1.1URIStruts1.2URI

struts-beanhttp://jakarta.apache.org/struts/tags-beanhttp://struts.apache.org/tags-bean

struts-htmlhttp://jakarta.apache.org/struts/tags-htmlhttp://struts.apache.org/tags-html

struts-logichttp://jakarta.apache.org/struts/tags-logichttp://struts.apache.org/tags-logic

struts-nestedhttp://jakarta.apache.org/struts/tags-nestedhttp://struts.apache.org/tags-nested

struts-templatehttp://jakarta.apache.org/struts/tags-templateNolongerincludedwithStruts;replacedbyTiles

struts-tileshttp://jakarta.apache.org/struts/tags-tileshttp://struts.apache.org/tags-tiles

struts-bean-elhttp://jakarta.apache.org/struts/tags-bean-elhttp://struts.apache.org/tags-bean-el

struts-html-elhttp://jakarta.apache.org/struts/tags-html-elhttp://struts.apache.org/tags-html-el

struts-logic-elhttp://jakarta.apache.org/struts/tags-logic-elhttp://struts.apache.org/tags-logic-el

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yiyi735/archive/2008/05/31/2498832.aspx