日期:2014-05-17  浏览次数:20675 次

sh框架的structs-config.xml报错
代码如下:
<?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*)".

------解决方案--------------------
</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>

应该是这样子才对 检查下吧