ssh配置文件

 applicationContext.xml文件

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">


<!-- 扫描注解 -->


<context:component-scan base-package="com.lanou"></context:component-scan>


<!-- 读取配置文件 -->
<context:property-placeholder location="classpath*:*.properties" />


<!-- 数据源 druid -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.loginName}"></property>
<property name="password" value="${jdbc.pwd}"></property>
<property name="driverClassName" value="${jdbc.driver}"></property>
</bean>
<!-- 会话工程 -->


<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<!-- 注入数据源 -->
<property name="dataSource" ref="dataSource"></property>
<!-- hibernate 属性 -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.current_session_context_class">${hibernate.session}</prop>
</props>
</property>


<!-- 扫描实体映射文件 -->
<property name="mappingLocations">
<list>
<value>classpath:com/lanou/entity/*.hbm.xml</value>

</list>
</property>
</bean>
<!-- 配置hibernate4事物管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />

</beans>

jdbc.properties

# dataSource key=value
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/house
jdbc.loginName=root
jdbc.pwd=root


# hibernate
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.format_sql=true


hibernate.session=org.springframework.orm.hibernate4.SpringSessionContext

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 value="UTF-8" name="struts.i18n.encoding" />
<!-- 请求后缀 -->
<constant value="do,action" name="struts.action.extension" />
<!-- 热部署加载struts.xml文件 -->
<constant value="true" name="struts.configuration.xml.reload" />
<!-- 开发模式 -->
<constant value="true" name="struts.devMode" />


<package name="default" namespace="/" extends="struts-default,json-default">
<action name="index" class="indexAction" method="index">
<result name="success" type="redirect">
index.jsp
</result>
</action>


<action name="list" class="indexAction" method="houseList">
<result name="success" type="json">
<!-- list 在indexaction 一定一个属性 -->
<param name="root">list</param>
</result>
</action>


<action name="delect" class="indexAction" method="delectHouse">
              <result name="success" type="redirect">
                index.jsp
              </result>
</action>


</package>


</struts>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值