开发者

Can jsp .tag files be included via a tld file like Java TagSupport classes?

开发者 https://www.devze.com 2023-04-08 02:41 出处:网络
Most of my tags are done with .tag files, as its much easier to work with html that way. However, my web applications expect these tags in the web.xml/tags directory, which is a pain when a tag is sha

Most of my tags are done with .tag files, as its much easier to work with html that way. However, my web applications expect these tags in the web.xml/tags directory, which is a pain when a tag is shared among multiple web apps.

If i understand correct, a java tag class that extends TagSupport can include the tld in the source code, and the tag can be imported easily. Can I do something like that for my .tag files so I can keep them in a shared parent project an开发者_StackOverflowd not worry about copying them to individual tag folders in my web applications? Is there a way for a tld to point to a .tag file on the classpath?


This page says:

Tag files can be placed in one of two locations: in the /WEB-INF/tags/ directory or subdirectory of a web application or in a JAR file (see Packaged Tag Files) in the /WEB-INF/lib/ directory of a web application. Packaged tag files require a tag library descriptor (see Tag Library Descriptors), an XML document that contains information about a library as a whole and about each tag contained in the library.

and

Tag files can be packaged in the /META-INF/tags/ directory in a JAR file installed in the /WEB-INF/lib/ directory of the web application. Tags placed here are typically part of a reusable library of tags that can be used easily in any web application.

Tag files bundled in a JAR require a tag library descriptor. Tag files that appear in a JAR but are not defined in a TLD are ignored by the web container.

When used in a JAR file, the path subelement of the tag-file element specifies the full path of the tag file from the root of the JAR. Therefore, it must always begin with /META-INF/tags/.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号