Mikolaj Rydzewski wrote:
Thomas Thomas wrote:
Well how am I supposed to declare my Struts taglibs then ?
You don't. All tld files are present in META-INF directory of specific jars. Servlet container looks for those files in that location and it works ;-)

Of course you can still put tld files in WEB-INF, WEB-INF/tld and specify them in web.xml, but you don't have to.


Adding more information to what Mikolaj Rydzewski wrote:

As per 2.0 spec of JSP it is enough if the TLD is contained in jar any where with in its META-INF directory / subdirectory. This means it does not require any explicit URI mapping in the web.xml file. See JSP 2.0: Section JSP.7.3.0. The container will identify the appropriate tlds from jars based on the <uri> declaration in the TLD file.


So if you look in your struts.jar with in META-INF/tlds you will find all the tld's defined. So considering an Example of struts-logic.tld which is in struts.jar/META-INF/tlds
View the above mentioned file.
-------------
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";>
<taglib>
<tlibversion>1.2</tlibversion>
<jspversion>1.1</jspversion>
<shortname>logic</shortname>
<uri>http://struts.apache.org/tags-logic</uri> --> Decalres uri element.
<tag>
<name>forward</name>

So in your jsp file you would just map to this uri. In above case to http://jakarta.apache.org/struts/tags-logic and use prefix as struts-logic or any other short name . Now you will refer to logic tags as usual in your jsp. So there is no necessity to specify any mapping in web.xml file and don't have to explicitly place the tld file in folder /WEB-INF/tld. The container does the hard work of resolving the correct tld based on the uri specified in your jsp to the appropriate tld in jars that are placed in WEB-INF/lib folder.

Hope this clarifies.

Thanks,
Vijay Venkataraman

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to