主要注意以下几点:
1)在web.xml中加入
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
2)在struts-config.xm中加入
<controller
processorClass="org.springframework.web.struts.DelegatingRequestProcessor">
</controller>
3)在applicationContext.xml中入与struts-config.xml中action对应的bean,如
在struts-config.xml中有
<action path="/test"
type="test.TestAction">
<forward name="success" path="/index.jsp"></forward>
</action>
在applicationContext.xml中要有
<bean id="gi" class="test.GI"></bean>
<bean name="/test" class="test.TestAction">
<property name="gi">
<ref bean="gi" />
</property>
</bean>
其中,bean的name的值即/test要和struts-config.xml中action的path的值一致,bean的property的name属性值为test.TestAction类中对test.GI类变量。