当前位置:   article > 正文

ssh 配置_ssh配置

ssh配置

dao层:

daoImpl:

private HibernateTemplate hibernateTemplate;
public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
this.hibernateTemplate = hibernateTemplate;
}


strut添加spring支持:

web.xml:

<!-- init context param -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>


<!-- used by spring to init beanFactory -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>


applicationContext.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">




<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>


<!-- 定义HibernateTemplate -->
<bean name="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>


<bean id="tUserService"
class="com.cszh.UserService.TUserServiceImpl">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean name="/login" class="com.cszh.UserAction.LoginAction">
<property name="service">
<ref bean="tUserService" />
</property>
</bean>
<!--配置事务管理器  -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

</beans>


jsp:

jstl标签:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

循环:<c:forEach var="list" items="${list}">
    <tr>${list.bookName}</tr>
    </c:forEach>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/887559?site
推荐阅读
相关标签
  

闽ICP备14008679号