zoukankan      html  css  js  c++  java
  • ssh环境搭建

    <?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:tx="http://www.springframework.org/schema/tx" 
            xmlns:aop="http://www.springframework.org/schema/aop"
            xmlns:context="http://www.springframework.org/schema/context" 
            xmlns:jee="http://www.springframework.org/schema/jee"
            xsi:schemaLocation="
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
        <bean id="mydataSource"
                class="org.apache.commons.dbcp.BasicDataSource">
                <property name="url"
                    value="jdbc:oracle:thin:@localhost:1521:orcl">
                </property>
                <property name="driverClassName" 
                    value="oracle.jdbc.driver.OracleDriver">
                </property>
                <property name="username" value="scott"></property>
                <property name="password" value="920525"></property>    
            </bean>
            
            
            <bean id="sessionFactory" 
                class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <!-- 注入连接参数 -->
                <property name="dataSource" ref="mydataSource">
                </property>
                
                <!-- 注入hibernate配置参数 -->
                <property name="hibernateProperties">
                    <props>
                        <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
                        <prop key="hibernate.show_sql">true</prop>
                        <prop key="hibernate.fromat_sql">true</prop>
                    </props>
                </property>    
                
                <!-- 设置加载的hbm.xml -->
                <property name="mappingResources">
                    <list>
                        <value>com/tarena/netctoss/pojo/cost.hbm.xml</value>
                        <value>com/tarena/netctoss/pojo/account.hbm.xml</value>
                    </list>
                </property>
            </bean>
            <!-- 开启组件扫描,后面的值是自己配置,看看需要扫描那些包,自己定义-->
            <context:component-scan base-package="com.tarena.netctoss"/>
        
         <!-- 声明事务管理,采用AOP形式切入 -->
            <bean id="txManager"
                class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                <property name="sessionFactory" ref="sessionFactory"></property>
            </bean>
            <tx:annotation-driven proxy-target-class="true" transaction-manager="txManager"/>
    </beans>

    上面是application.xml文件配置

    下面是web.xml文件中的配置

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
        xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
            <!-- 指定要加载的Spring文件 -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext-*.xml</param-value>
        </context-param>
        
        <!-- 用于实例化Spring容器,默认加载/WEB-INF/applicationContext.xml -->
        <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener    
            </listener-class>
        </listener>
        
        <filter>
            <filter-name>opensessioninview</filter-name>
            <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
            </filter-class>
        </filter>
    
        
        <filter>
            <filter-name>Struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
        
        <filter-mapping>
            <filter-name>opensessioninview</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
        
        <filter-mapping>
            <filter-name>Struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>

    再有struts.xml文件的话,这个里面简单,自己写就可以了(也得根据需求来写)

    再将ssh的jar包都导入,基本上基本的ssh环境就搭建好了

  • 相关阅读:
    How to Compile Java DBus
    BZOJ 2783 JLOI 2012 树 乘+二分法
    Robotium原则的实施源代码分析
    基本的负载均衡算法
    人大、上财、复旦、上交四校2013年应届金融硕士就业去向
    2014届上财金融硕士就业情况
    三跨),总分420+
    复旦金融专硕和上财金融专硕
    一个三跨考生三战上海财经大学金融硕士的考研经验
    董某某
  • 原文地址:https://www.cnblogs.com/zhoushengbing/p/3226807.html
Copyright © 2011-2022 走看看