struts2和spring整合时为什么总是找不到struts.xml里面的class
struts.xml文件<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwa...
struts.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.i18n.encoding" value="GBK"/>
<constant name="struts.objectFactory.spring.autoWire" value="name" />
<constant name="struts.objectFactory" value="spring"/>
<package name="login" extends="struts-default">
<action name="*_inforAction" method="{1}" class="inforAction">
<result name="selectInfor">/ItemManagement/itemManagement.jsp</result>
<result name="addInfor">/ItemManagement/itemManagement.jsp</result>
<result name="updateInfor">/ItemManagement/updateItem.jsp</result>
<result name="update2Infor">/ItemManagement/itemManagement.jsp</result>
</action>
<action name="*_customerAction" method="{1}" class="custAction">
<result name="selectCustomer">/ItemManagement/inforManagement.jsp</result>
<result name="updateCustomer">/ItemManagement/updateInfor.jsp</result>
</action>
<action name="*_relationAction" method="{1}" class="relaAction">
<result name="selectRela">/ItemManagement/relationAll.jsp</result>
<result name="addPage">/ItemManagement/insertRelation.jsp</result>
</action>
</package>
</struts>
applicationContext.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="custAction" class="com.easy.action.CustAction">
<property name="custService" ref="customerService"></property>
</bean>
<bean id="inforAction" class="com.easy.action.InforAction">
<property name="inforManageService" ref="inforService"></property>
</bean>
<bean id="relaAction" class="com.easy.action.RelaAction">
<property name="relationService" ref="relationService"></property>
</bean>
</beans>
struts属性文件
struts.objectFactory=com.opensymphony.xwork2.ObjectFactory 展开
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.i18n.encoding" value="GBK"/>
<constant name="struts.objectFactory.spring.autoWire" value="name" />
<constant name="struts.objectFactory" value="spring"/>
<package name="login" extends="struts-default">
<action name="*_inforAction" method="{1}" class="inforAction">
<result name="selectInfor">/ItemManagement/itemManagement.jsp</result>
<result name="addInfor">/ItemManagement/itemManagement.jsp</result>
<result name="updateInfor">/ItemManagement/updateItem.jsp</result>
<result name="update2Infor">/ItemManagement/itemManagement.jsp</result>
</action>
<action name="*_customerAction" method="{1}" class="custAction">
<result name="selectCustomer">/ItemManagement/inforManagement.jsp</result>
<result name="updateCustomer">/ItemManagement/updateInfor.jsp</result>
</action>
<action name="*_relationAction" method="{1}" class="relaAction">
<result name="selectRela">/ItemManagement/relationAll.jsp</result>
<result name="addPage">/ItemManagement/insertRelation.jsp</result>
</action>
</package>
</struts>
applicationContext.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="custAction" class="com.easy.action.CustAction">
<property name="custService" ref="customerService"></property>
</bean>
<bean id="inforAction" class="com.easy.action.InforAction">
<property name="inforManageService" ref="inforService"></property>
</bean>
<bean id="relaAction" class="com.easy.action.RelaAction">
<property name="relationService" ref="relationService"></property>
</bean>
</beans>
struts属性文件
struts.objectFactory=com.opensymphony.xwork2.ObjectFactory 展开
4个回答
2010-08-16
展开全部
在Struts.xml里面的constant定义改为,特别是第二条,和你之前的定义方式不一样了。
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<constant name="struts.objectFactory.spring.autoWire" value="type" />
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<constant name="struts.objectFactory.spring.autoWire" value="type" />
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
导入插件包 struts2-spring-plugin-2.1.8.jar
struts属性文件
struts.objectFactory=com.opensymphony.xwork2.ObjectFactory //这个不要写
struts属性文件
struts.objectFactory=com.opensymphony.xwork2.ObjectFactory //这个不要写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
struts.xml中action的路径没写全
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
struts.objectFactory=spring
struts.objectFactory.spring.autoWire=name
试试
struts.objectFactory.spring.autoWire=name
试试
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询