zoukankan      html  css  js  c++  java
  • SSH 搭建

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


        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
            <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
            <property name="username" value="t03"></property>
            <property name="password" value="bdqn"></property>
        </bean>
        <!-- 01.创建一个sessionFactory -->
        <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <!-- <property name="configLocation" value="classpath:hibernate.cfg.xml"></property> -->
            <property name="dataSource" ref="dataSource" />
            <property name="mappingResources">
                <list>
                    <value>an/bean/Emp.hbm.xml</value>
                </list>

            </property>
        </bean>
        <!-- 02.配置dao层 -->
        <bean id="EmpDaoImpl" class="an.dao.impl.EmpDaoImpl"
            p:sessionFactory-ref="sessionFactory">
        </bean>
        <!--03. service -->
        <bean id="EmpServiceImpl" class="an.service.impl.EmpServiceImpl"
            p:dao-ref="EmpDaoImpl">
        </bean>
        <bean id="empaction" class="an.action.EmpAction" p:service-ref="EmpServiceImpl"></bean>

    </beans>

    Struts2

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
    <struts>
        <!-- <constant name="struts.objectFactory" value="spring" /> -->
        <package name="default" namespace="/" extends="struts-default">
            <action name="list" class="loginAction" method="login">
                <result>/UserList.jsp</result>
                <result name="input">/login.jsp</result>
             </action>
             <action name="add" class="loginAction" method="add">
                <result>/UserList.jsp</result>
                <result name="input">/add.jsp</result>
             </action>    
        </package>
    </struts>
    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
      <display-name />
       <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
        </context-param>
        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
     
        
         <welcome-file-list>
            <welcome-file>login.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    Emp.hbm.xml

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- Mapping file autogenerated by MyEclipse Persistence Tools -->
    <hibernate-mapping>
        <class name="an.bean.Emp" table="emp1">
            <id name="empNo">
                <generator class="increment" />
            </id>
            <property name="empName" />
            <property name="job" />
        </class>
    </hibernate-mapping>

  • 相关阅读:
    Ubuntu 14.04 LTS Server 无法挂载光盘 启动initramfs等问题
    Linux的交叉编译 及configure配置
    大话设计模式读书笔记(五) 代理模式
    大话设计模式读书笔记(三) 单一职责原则和开放-封闭原则和依赖倒转原则
    大话设计模式读书笔记(二) 策略模式
    Java NIO(一) 初步理解NIO
    大话设计模式读书笔记(一) 简单工厂模式
    多线程设计模式(一) Single Threaded Execution
    多线程详细解析(二) 线程的共享互斥与线程的协调
    多线程详细解析(一) 创建线程
  • 原文地址:https://www.cnblogs.com/anshuo/p/5377617.html
Copyright © 2011-2022 走看看