在 JSP 2.0 规范中,它提到了 taglib 指令的“tagdir”属性 (JSP.1.10.2):
Indicates this prefix is to be used to identify tag extensions installed in the /WEB-INF/tags/ directory or a subdirectory. An implicit tag library descriptor is used. A translation error must occur if the value does not start with /WEB-INF/tags/.
如您所见,它必须有一个尾部斜杠,“/WEB-INF/tags”是不够的。它一定会产生编译错误!
我们在尾部斜杠和 Eclipse 方面遇到了很多问题。 Eclipse 编辑此类 jsp 文件的速度变慢。所以我们确实删除了尾部斜杠,并且 Eclipse 再次正常运行。
大多数 jsp 教程和书籍不使用尾部斜杠。
在 jsp 2.1 规范中,不再需要尾部斜杠。
我想知道他们是否有任何 jsp 实现抛出编译错误? 或者不使用尾部斜杠是否安全?
最佳答案
不知道其他 servlet 容器,但对于 Tomcat,除了 /WEB-INF/tags
之外,我从未使用过任何其他容器。
关于java - 如果 tagdir 属性没有尾部斜杠,是否有任何 jsp 2.0 实现会强制出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4667864/