---
title: "J2EE 0.1—spring整合struts方法及纠错(原创)"
author: "cui09"
date: "2007-08-07T21:02:00Z"
tags: []
slug: "j2ee-0-1-spring-struts"
draft: false
lastmod: "2007-08-07T21:02:00Z"
id: 109850
url: "https://cui.iteye.com/blog/109850"
---

xml 代码

01. xml version="1.0" encoding="UTF-8"?&gt;
02. &gt;
03. &lt;struts-config&gt;
04. &lt;data-sources /&gt;
05. &lt;form-beans&gt;
06. &lt;form-bean name="userLoginForm"
07. type="org.perfect.struts.form.UserLoginForm" /&gt;
08. form-beans&gt;
09. &lt;global-exceptions /&gt;
10. &lt;global-forwards /&gt;
11. &lt;action-mappings&gt;
12. &lt;action
13. input="/userLogin.jsp"
14. path="/userLogin"
15. scope="request"
16. name="userLoginForm"
17. type="org.springframework.web.struts.DelegatingActionProxy"
18. &gt;
19. action&gt;
20. action-mappings&gt;
21. &lt;message-resources
22. parameter="org.perfect.struts.ApplicationResources" /&gt;
23. &lt;plug-in
24. className="org.springframework.web.struts.ContextLoaderPlugIn"&gt;
25. &lt;set-property property="contextConfigLocation"
26. value="/WEB-INF/applicationContext.xml" /&gt;
27. plug-in&gt;
28. struts-config&gt;

xml 代码

01. xml version="1.0" encoding="UTF-8"?&gt;
02. &lt;beans
03. xmlns="http://www.springframework.org/schema/beans"
04. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
05. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"&gt;
06. &lt;bean id="user" class="org.perfect.struts.vo.User"&gt;bean&gt;
07. &lt;bean name="/userLogin" class="org.perfect.struts.action.UserLoginAction" scope="singleton"&gt;
08. &lt;property name="user"&gt;
09. &lt;ref bean="user" /&gt;
10. property&gt;
11. bean&gt;
12. beans&gt;

&lt;html:form action="/userLogin"&gt; &lt;/html:form&gt;