代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config> //报错行
  <data-sources />
  <form-beans >
  <form-bean name="loginForm" type="com.ssh.struts.form.LoginForm" />
   </form-beans>
  <action-mappings />
  <action
  attribute="loginForm"
  input="/login.jsp"
  name="loginForm"
  path="/login"
  scope="request"
  type="com.ssh.struts.action.LoginAction" >
  <forward name="suc" path="/index.jsp" />
  </action>
</struts-config>报错提示:The content of element type "struts-config" must match "(displayname?,description?,datasources?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resources*,plug-in*)".

解决方案 »

  1.   

    在</struts-config>上面一行少了个</action-mappings>
      

  2.   

    form-beans >
      <form-bean name="loginForm" type="com.ssh.struts.form.LoginForm" />
       </form-beans>这几句,有问题。
    你应该把</form-beans>去掉
      

  3.   

    你看下struts-config.xml对应的dtd文件,看看他们这些元素出现的顺序。估计你对dtd不熟
      

  4.   

    可能是标签用错了,从你报错的dtd来看("datasources?")date-sources没有中间那个小横杠,还有,你的action和action-mapping的顺序没有错。你看看例子重写一次吧。
      

  5.   

    你用的是struts1吧   在你的
    </form-beans>
    <global-exceptions />
    <action-mappings>
      

  6.   

    在你的</form-beans>和<action-mappings>之间加上<global-exceptions />
    <action></action>这个区段要放在<action-mappings></action-mappings>之间才行
    你试下吧  应该就是这两个问题  希望这个能帮到你  
      

  7.   

     </form-beans>
      <action-mappings />
      <action
      attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="com.ssh.struts.action.LoginAction" >
      <forward name="suc" path="/index.jsp" />
      </action>你的这个地方应该改成
    </form-beans>
    <global-exceptions />
      <action-mappings>
      <action
      attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="com.ssh.struts.action.LoginAction" >
      <forward name="suc" path="/index.jsp" />
      </action>
    </action-mappings>应该是这样子才对  检查下吧