web.xml中taglib标签报错问题解决方案

<taglib>标签在web.xml文件中报错解决方法配置web.xml文件时,taglib标签报错,但不会影响程序的运行,,web.xml 如下:< xml version="1.0" encoding="UTF-8" ><web-app id="WebApp_ID" version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <display-name>testSitemesh</display-name> <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <taglib> <taglib-uri>sitemesh-decorator</taglib-uri> <taglib-location>/WEB-INF/sitemesh-decorator.tld</taglib-location> </taglib> <taglib> <taglib-uri>sitemesh-page</taglib-uri> <taglib-location>/WEB-INF/sitemesh-page.tld</taglib-location> </taglib> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list></web-app>其中的taglib标签加入后,eclipse报错,内容如下:cvc-complex-type.2.4.a: Invalid content was found starting with element ‘taglib’. One of ‘{"":description, "":display-name, "":icon, "":distributable, "":context-param, "":filter, "":filter-mapping, "":listener, "":servlet, "":servlet-mapping, "":session-config, "":mime-mapping, "":welcome-file-list, "":error-page, "":jsp-config, "":security-constraint, "":login-config, "":security-role, "":env-entry, "":ejb-ref, "":ejb-local-ref, "":service-ref, "":resource-ref, "":resource-env-ref, "":message-destination-ref, "":message-destination, "":locale-encoding-mapping-list}’ is expected.解决方法有两个:1、把<web-app id="WebApp_ID" version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">这句改成<web-app >解 释:在jsp2.0中,且2.4版的DTD验证中,初步估计是由于eclipse在部署时,未对web.xml进行一些校验,而jbuilder则进行了 校验,并除非不合法的描述符,而taglib描述符,正确写法是放到<jsp-config$amp;>amp;$lt;/jsp-config>描述符 中。2、在taglib外面加个jsp-config标签:<jsp-config> <taglib> <taglib> <taglib-uri>sitemesh-decorator</taglib-uri> <taglib-location>/WEB-INF/sitemesh-decorator.tld</taglib-location> </taglib> <taglib> <taglib-uri>sitemesh-page</taglib-uri> <taglib-location>/WEB-INF/sitemesh-page.tld</taglib-location> </taglib></jsp-config><jsp-config>标签使用详解:<jsp-config> 包括<taglib> 和<jsp-property-group> 两个子元素。其中<taglib>元素在JSP 1.2时就已经存在;而<jsp-property-group>是JSP 2.0 新增的元素。<jsp-property-group>元素主要有八个子元素,它们分别为:1.<description>:设定的说明;2.<display-name>:设定名称;3.<url-pattern>:设定值所影响的范围,如:/CH2 或 /*.jsp;4.<el-ignored>:若为true,表示不支持EL 语法;5.<scripting-invalid>:若为true,表示不支持<% scripting %>语法;6.<page-encoding>:设定JSP 网页的编码;7.<include-prelude>:设置JSP 网页的抬头,扩展名为.jspf;8.<include-coda>:设置JSP 网页的结尾,扩展名为.jspf。

你曾经说,你曾经说。走在爱的旅途,我们的脚步多么轻松……

web.xml中taglib标签报错问题解决方案

相关文章:

你感兴趣的文章:

标签云: