Web.xml配置標籤報錯問題(cvc-complex-type.2.4.a: Invalid content was found starting with element 'tag

Web.xml配置<taglib>標籤報錯問題cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. 解決方案:

出錯Code:

  <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-html</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-logic</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-nested</taglib-uri>
    <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-tiles</taglib-uri>
    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  </taglib>
  
  <taglib>
         <taglib-uri>control</taglib-uri>
         <taglib-location>/WEB-INF/mytag.tld</taglib-location>
   </taglib>   

將其前後加上<jsp-config></jsp-config>標籤就能解決問題

<jsp-config>
  <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-html</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-logic</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-nested</taglib-uri>
    <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
  </taglib>


  <taglib>
    <taglib-uri>/tags/struts-tiles</taglib-uri>
    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  </taglib>
  
  <taglib>
         <taglib-uri>control</taglib-uri>
         <taglib-location>/WEB-INF/mytag.tld</taglib-location>
   </taglib>   
  </jsp-config>

實際上<jsp-config>標籤中還含有<jsp-property-group>
</jsp-property-group>標籤,其具體熟悉,可以在eclipse裏面的web。xml文件中會自動提示。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章