java web.xml 中的 taglib 配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15873317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 21:08:41  来源:igfitidea点击:

taglib configuration in web.xml

javaspringjakarta-eejsp-tags

提问by prashant

  <taglib>
  <taglib-uri>  http://www.java2s.com/custom  </taglib-uri>
  <taglib-location>   /WEB-INF/tags/NewFile.tld  </taglib-location>
  </taglib>

it is showing the error

它显示错误

cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/javaee":module-name, "http://java.sun.com/xml/ns/javaee":description,

cvc-complex-type.2.4.a:发现以元素“taglib”开头的无效内容。'{" http://java.sun.com/xml/ns/javaee":module-name, " http://java.sun.com/xml/ns/javaee":description 之一,

any body please sugest me a way to solve this

任何机构请建议我解决这个问题的方法

回答by prashant

web.xml is validated against an XML schema. This schema specifies that taglib can occur only when enclosed by a jsp-config tag.

web.xml 根据 XML 模式进行验证。此模式指定 taglib 只能在被 jsp-config 标记包围时出现。

Hence surround your taglib tag by a jsp-config tag

因此用 jsp-config 标签包围你的 taglib 标签

Please Refer: http://docs.oracle.com/cd/E11035_01/wls100/webapp/web_xml.html#wp1071166

请参考:http: //docs.oracle.com/cd/E11035_01/wls100/webapp/web_xml.html#wp1071166

for further details.

了解更多详情。

Also taglib is no longer required to be declared in web.xml , please read http://wiki.metawerx.net/wiki/RemovingTaglibFromWeb.xml

此外,不再需要在 web.xml 中声明 taglib,请阅读http://wiki.metawerx.net/wiki/RemovingTaglibFromWeb.xml