浏览 9322 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2005-05-08
Spring+Struts+hibernate 配置文件: ********************************** <?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> <!-- ========== Data Source Configuration =============================== --> <data-sources /> <!-- ========== Form Bean Definitions ================================== --> <form-beans> <form-bean name="simpleSearchForm" type="gov.ntcri.presentation.formbean.SimpleSearchForm" /> <form-bean name="dateSearchForm" type="gov.ntcri.presentation.formbean.DateSearchForm" /> <form-bean name="filetypemaintqueryForm" type="gov.ntcri.presentation.formbean.collection.form.FiletypemaintqueryForm"> <form-property name="creator" type="java.lang.String" /> <form-property name="docName" type="java.lang.String" /> <form-property name="modifier" type="java.lang.String" /> <form-property name="description" type="java.lang.String" /> <form-property name="modifyDate" type="java.lang.String" /> <form-property name="createDate" type="java.lang.String" /> <form-property name="comment" type="java.lang.String" /> <form-property name="categoryId" type="java.lang.String" /> </form-bean> </form-beans> <!-- ========== Global Exception Definitions ============================== --> <global-exceptions> <exception handler="com.dsii.common.web.struts.CustomizedExceptionHandler" key="global.errorHandler.message" path="/errors/error.jsp" type="java.lang.Throwable" /> </global-exceptions> <!-- ========== Global Forward Definitions =============================== --> <global-forwards> <forward name="login" path="/login.jsp" /> <forward name="error" path="/errors/error.jsp" /> </global-forwards> <!-- ========== Action Mapping Definitions =============================== --> <action-mappings> <!--tiles dispatch action e.g /dispatch.do?def=....--> <action parameter="def" path="/dispatch" type="org.apache.struts.tiles.actions.DefinitionDispatcherAction"> <forward name="success" path="anything" /> </action> </action-mappings> <!-- ========== Controller Configuration ================================ --> <controller /> <!-- ========== Message Resources Definitions ============================ --> <message-resources null="false" parameter="resources.ApplicationResources" /> <!-- ========== Plug Ins Configuration ================================= --> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" /> </plug-in> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml,/WEB-INF/tiles/jason-tiles-defs.xml,/WEB-INF/tiles/tunky-tiles-defs.xml,/WEB-INF/tiles/jasonyu-tiles-defs.xml,/WEB-INF/tiles/sun-tiles-defs.xml,/WEB-INF/tiles/morgan-tiles-defs.xml,/WEB-INF/tiles/calin-tiles-defs.xml" /> <set-property property="moduleAware" value="true" /> </plug-in> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml,/WEB-INF/validations/morgan-validation.xml,/WEB-INF/validations/calin-validation.xml,/WEB-INF/validations/jason-validation.xml,/WEB-INF/validations/sun-validation.xml" /> </plug-in> <!--login--> <action name="loginForm" parameter="method" path="/loginAction" type="org.springframework.web.struts.DelegatingActionProxy" input="/login.jsp" validate="true"> <forward name="userMainRelist" path="/admin/userListAction.do?method=listAll" /> </action> <action parameter="method" path="/logoutAction" type="gov.ntcri.presentation.action.admin.LoginAction" > </action> </struts-config> ************************************** <?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="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>net.sourceforge.jtds.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:jtds:Sqlserver://127.0.0.1:1433/NTCRI;charset=CP936;SelectMethod=CURSOR</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value>sa</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="mappingResources"> <list> <value>gov\ntcri\domain\po\admin\DepartmentPO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\TitlePO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\UserPO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\FunctionPO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\FunctionLogPO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\LoginLogPO.hbm.xml</value> <value>gov\ntcri\domain\po\admin\GroupPO.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <bean id="loginLogDAO" class="gov.ntcri.domain.dao.admin.LoginLogDAO"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <bean id="loginLogMaintBean" class="gov.ntcri.domain.bean.admin.LoginLogMaintBean"> <property name="loginLogDAO"> <ref bean="loginLogDAOProxy" /> </property> </bean> <bean id="loginLogDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> <property name="target"> <ref local="loginLogDAO" /> </property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> <bean name="/loginAction" class="gov.ntcri.presentation.action.admin.LoginAction" singleton="false"> <property name="loginLogMaintBean"> <ref bean="loginLogMaintBean" /> </property> </bean> 错误提示信息: 页面提示信息 The requested resource (Servlet action is not available) is not available 你的分析: 我在改动一个原来用Struts写的程序,想用Spring来做他的事务处理。我改动以后当第一个页面提交以后 提示 The requested resource (Servlet action is not available) is not available 红色的地方是我改动的地方 不知道我那里出错拉 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2005-05-08
在spring bean里加入你的action
<bean name="/loginAction" class="这里写你的ACTION" singleton="false"> <property name="yourpro"> <ref bean="yourpro"/> </property> </bean> 另: 引用 我在改动一个原来用Struts写的程序,想用Spring来做他的事务处理。 Action中用事务管理??? |
|
返回顶楼 | |
发表时间:2005-05-09
我的applicationContext.xml copy 时在论坛掉拉一点,你说的我已经写上去啦 。。还是不行!
我在论坛上下载拉一个例子,也还是调试通不过,我用的 是tomcat5.5 引用 Action中用事务管理???
action作调度! |
|
返回顶楼 | |
发表时间:2005-05-09
如果部署的时候没出错而是在执行时出错的话,应该就是你的ACTION类的问题了,而不是XML文件的问题了!
|
|
返回顶楼 | |
发表时间:2005-07-04
把你的tomcat中的log日志贴出来瞧瞧
|
|
返回顶楼 | |
发表时间:2005-07-04
是啊!将 tomcat的log贴出来让偶们悄悄!
|
|
返回顶楼 | |
发表时间:2005-07-17
你是用spring的Ioc来管理你的Action的,
所以要在struts-config.xml文件中添加: <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor" /> |
|
返回顶楼 | |
发表时间:2005-07-29
spring 配置文件应该有错误,具体错误你看一下tomcat的log日志。
|
|
返回顶楼 | |
发表时间:2005-08-04
我做拉个很简单可以远行的事例.还有不能远行的同志可以跑一下.
环境:sql,hibernate 2,sturts 2,spring 1.2. 修改:ssh\WEB-INF\springconfig.xml的数据库配置. 相关的lib要自己加. |
|
返回顶楼 | |