• 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>

  • 相关阅读:
    pandas去重方法
    原生表单组件
    html表单
    html表格基本标签
    文档和网站架构
    文本格式
    【Leetcode链表】奇偶链表(328)
    【Leetcode链表】移除链表元素(203)
    【Leetcode链表】旋转链表(61)
    【Leetcode链表】反转链表 II(92)
  • 原文地址:https://www.cnblogs.com/anshuo/p/5377617.html
Copyright © 2020-2023  润新知