读书人

整合struts2 spring 有关问题

发布时间: 2012-12-24 10:43:13 作者: rapoo

整合struts2 spring 问题
严重: Exception starting filter struts2 Action class [registerAction] not found - action - file:/G:


applicationContex.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
……
<!-- DAO -->
<bean id="dao" ref="sessionFactory"></property>
</bean>
<!-- UserService -->
<bean id="service" ref="dao"></property>
</bean>
<!-- UserAction -->
<bean id="registerAction" scope="prototype">
<property name="service" ref="service"></property>
</bean>
</beans>

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>
<!-- 设置Web应用的默认编码集为gbk -->
<constant name="struts.i18n.encoding" value="UTF-8"/>
<!-- 设置Web应用的默认Locale为zh_CN -->
<constant name="struts.locale" value="zh_CN" />
<!-- 设置Struts2应用的国际化资源文件,多个文件中间可用逗号分隔 -->
<constant name="struts.custom.i18n.resources" value="messageResource"/>
<!-- 设置Struts2默认的ObjectFactory为spring -->
<constant name="struts.objectFactory" value="spring" />
<!-- 设置Struts2应用是否处于开发模式,通常在开发调试阶段设为true,正式上线后可设为false -->
<constant name="struts.devMode" value="true" />
<!-- 设置Struts2的默认主题为simple -->
<constant name="struts.ui.theme" value="simple" />
<package name="user" extends="struts-default">
<action name="register" method="register">
<result name="success">/common/regsuccess.jsp</result>
<result name="input">/common/register.jsp</result>
</action>
</package>
</struts>

-----------------------struts2配置文件解析-------------

读书人网 >编程

热点推荐