2013-05-02 84 views
1

我正在尝试将Struts与Spring集成。 单独的Struts工作正常。然而,当我试图把struts + spring与struts-config.xml的集成问题

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> 
     <set-property property="contextConfigLocation" 
      value="/WEB-INF/lib/WebApplicationSpringContext.xml" /> 
    </plug-in> 
    <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> 

元素在侧面的struts-config.xml中,XML开始扔

The content of element type "struts-config" must match "(data-sources?,form-beans?,global-exceptions?,global- 
forwards?,action-mappings?,controller?,message-resources*,plug-in*)". 

以下是我的struts-config.xml

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> 

<struts-config> 


    <form-beans> 
     <form-bean name="userForm" 
      type="com.sample.form.UserForm" /> 
    </form-beans> 

    <action-mappings> 

    <action path="/user" type="com.sample.action.UserAction" 
      name="userForm" scope="request" validate="true"> 
      <forward name="success" path="/WEB-INF/jsp/welcome.jsp" /> 
      <forward name="failed" path="/WEB-INF/jsp/user.jsp" /> 
     </action> 

    </action-mappings> 

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> 
     <set-property property="contextConfigLocation" 
      value="/WEB-INF/lib/WebApplicationSpringContext.xml" /> 
    </plug-in> 

    <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> 

</struts-config> 

继is WebApplicationSpringContext.xml

<?xml version="1.0" encoding="UTF-8" ?> 

<beans:beans xmlns="http://www.springframework.org/schema/security" 
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/jdbc 
     http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd  
     http://www.springframework.org/schema/security 
     http://www.springframework.org/schema/security/spring-security-3.0.xsd 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> 

    <beans:bean name="/user" id="user" 
     class="com.sample.action.UserAction"> 
     <beans:constructor-arg index="0" value="sample" /> 
    </beans:bean> 

</beans:beans> 

我被struts-config.xml卡住了。先谢谢了。任何建议将受到欢迎。

回答

1

元素类型 “的struts-config” 必须匹配“的内容(数据来源?,形豆?,全球异常?,GLOBAL- 向前?,动作映射?,控制器?,消息-resources *插件*)”。

尝试把:

<controller processorClass=...

以上:

<plug-in className="

意义切换标签订购

+0

这点上感谢@orid。它帮助了我。 – 2013-05-02 10:51:28