主要是通过配置applicationContext-*.xml实现
和hibernate整合的话需要配置sessionFactory,将hibernate的映射文件hibernate.cfg.xml引入进来;
和struts整合需要配置相关的Action
和hibernate整合的话需要配置sessionFactory,将hibernate的映射文件hibernate.cfg.xml引入进来;
和struts整合需要配置相关的Action
解决方案 »
- 看项目源码时的疑问
- 请教如何使用apache HttpClient使用HTTPS协议访问服务器
- java解析xlsx
- 用Quartz的时间规则问题
- 怎么得到泛型的类型?
- MyEclipse5.5 mysql5.0 structs1.2 登录报空指针异常 NullPointerException
- ★ why the filter doesn't work on <many-to-one>
- 急!JBuilder 9的工程编译后怎么会有3137个错误?!晕
- 有没有做过LDAP研究的朋友,留个email或qq号交个朋友交流一下行吗?十分感激
- 高手请进:关于jtree
- 在java 里面使用水晶报表怎么实现多语言化, 急,急,急!
- hibernate中的删除问题
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>然后把这个sessionFactory注入到Dao实现类里面,前提是Dao实现类继承了org.springframework.orm.hibernate3.support.HibernateDaoSupport这个类注入XML代码(假设是userDao):<bean id="userDao" class="com.project.dao.impl.UserDao">
<property name="sessionFactory" ref="sessionFactory" />//这个sessionFactory就是你上面注入好的
</bean>当然,这个userDao里面并没有sessionFactory这个属性,不过它的父类HibernateDaoSupport里面有这个属性。之后,dao里面就可以用super.getHibernateTemplate()里面的方法执行增、删、改、查了,这个你自己去试试吧
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="classpath:applicationContext.xml" />
</plug-in>然后把struts-config.xml里面的每个action的type属性配成org.springframework.web.struts.DelegatingActionProxy最后,我们回到applicationContext.xml文件:
<bean name="/user" class="com.project.web.action.UserAction">
<property name="userBiz" ref="userBiz" />//这个userBiz是之前配好的
</bean>当然,你每个action类里面肯定是要有一个biz的属性的,我只能详细到这个份上了