The content of element type "strutsconfig" must match "(displayname?,descripti .

配置struts-config.xml 时,报出了异常信息:

 

Java代码  收藏代码
  1. The content of element type "struts-config" must match "(display-name?,description?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resources*,plug-in*)".  

 

解决办法:

 

struts-config.xml 中的元素顺序有严格的要求,它们的位置不能错位,不然就会报错.

 

 

正确的顺序,参考代码: 

Java代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">  
  3. <struts-config>  
  4.         <form-beans>  
  5.         </form-beans>  
  6.   
  7.         <global-exceptions>  
  8.         </global-exceptions>  
  9.   
  10.         <global-forwards>  
  11.         </global-forwards>  
  12.   
  13.         <action-mappings>  
  14.             <action path="/index" type="org.apache.struts.actions.ForwardAction" parameter="index-tiles"></action>  
  15.         </action-mappings>  
  16.   
  17.         <controller>  
  18.             <set-property property="processorClass" value="org.apache.struts.tiles.TilesRequestProcessor"/>  
  19.         </controller>  
  20.   
  21.         <message-resources parameter="com.test.struts.ApplicationResources" />  
  22.   
  23.         <plug-in className="org.apache.struts.tiles.TilesPlugin">  
  24.             <set-property value="/WEB-INF/tiles/tiles-defs.xml" property="definitions-config"></set-property>  
  25.         </plug-in>  
  26. </struts-config>  
原文地址:https://www.cnblogs.com/a1280055207/p/3116833.html