<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    SSI整合--搭建Struts2+Spring+Ibatis框架

    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"
             xsi:schemaLocation
    ="http://java.sun.com/xml/ns/javaee
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

             version
    ="2.5">
      
    <context-param>
            
    <param-name>contextConfigLocation</param-name>
            
    <param-value>classpath:spring-config.xml</param-value>
        
    </context-param>

        
    <listener>
            
    <listener-class>
                org.springframework.web.context.ContextLoaderListener
            
    </listener-class>
        
    </listener>

        
    <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>
    </web-app>

    spring-config.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.xsd">
        
    <!--如非必要, 請不要改動這個文件, 擴充spring的配置請新建spring-context*.xml-->
        
    <!--此bean告訴Spring去哪找數據庫的配置信息,因為有此Bean才出現下面用${}標記來取變量的語句-->
        
    <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            
    <property name="locations">
                
    <list>
                    
    <value>classpath:spring-jdbc.properties</value>
                
    </list>
            
    </property>
        
    </bean>

        
    <!--配置一個數據源,根據上面propertyConfig指定的location去找數據庫連接的配置信息-->
        
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            
    <property name="driverClassName">
                
    <value>${jdbc.driver}</value>
            
    </property>
            
    <property name="url">
                
    <value>${jdbc.url}</value>
            
    </property>
            
    <property name="username">
                
    <value>${jdbc.username}</value>
            
    </property>
            
    <property name="password">
                
    <value>${jdbc.password}</value>
            
    </property>

        
    </bean>

        
    <!--根據dataSource和configLocation創建一個SqlMapClient-->

        
    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
            
    <property name="dataSource">
                
    <ref local="dataSource"/>
            
    </property>
            
    <property name="sqlMapClientProperties">
                
    <props>
                    
    <prop key="jdbcDriver">${jdbc.driver}</prop>
                
    </props>
            
    </property>
            
    <property name="configLocation">
                
    <value>classpath:SqlMapConfig.xml</value>
            
    </property>
        
    </bean>


        
    <!--根據sqlMapClien創建一個SqlMapClient模版類-->
        
    <bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>


        
    <!--DAO-->
        
    <bean id="addressDAO" class="cn.hhit.gwap.dao.ibatis.AddressDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <bean id="bookDAO" class="cn.hhit.gwap.dao.ibatis.BookDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <bean id="categoryDAO" class="cn.hhit.gwap.dao.ibatis.CategoryDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <bean id="itemDAO" class="cn.hhit.gwap.dao.ibatis.ItemDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <bean id="orderDAO" class="cn.hhit.gwap.dao.ibatis.OrderDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>
        
    <bean id="productDAO" class="cn.hhit.gwap.dao.ibatis.ProductDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <bean id="userDAO" class="cn.hhit.gwap.dao.ibatis.UserDAOIbatis">
            
    <property name="sqlMapClient">
                
    <ref bean="sqlMapClient"/>
            
    </property>
        
    </bean>

        
    <!--Action-->
        
    <!--User部分-->
        
    <bean id="checkEmailAction" class="cn.hhit.gwap.action.user.CheckEmailAction" scope="prototype">
            
    <property name="userDAO">
                
    <ref bean="userDAO"/>
            
    </property>
        
    </bean>

         
    <bean id="loginAction" class="cn.hhit.gwap.action.user.LoginAction" scope="prototype">
            
    <property name="userDAO">
                
    <ref bean="userDAO"/>
            
    </property>
        
    </bean>

         
    <bean id="registAction" class="cn.hhit.gwap.action.user.RegistAction" scope="prototype">
            
    <property name="userDAO">
                
    <ref bean="userDAO"/>
            
    </property>
        
    </bean>

         
    <bean id="imageAction" class="cn.hhit.gwap.action.user.ImageAction" scope="prototype"></bean>

         
    <bean id="varifyAction" class="cn.hhit.gwap.action.user.VarifyAction" scope="prototype">
            
    <property name="userDAO">
                
    <ref bean="userDAO"/>
            
    </property>
        
    </bean>

        
    <!--main部分-->
        
    <bean id="bookDetailAction" class="cn.hhit.gwap.action.main.BookDetailAction" scope="prototype">
            
    <property name="productDAO">
                
    <ref bean="productDAO"/>
            
    </property>
             
    <property name="bookDAO">
                
    <ref bean="bookDAO"/>
            
    </property>
        
    </bean>

           
    <bean id="bookListAction" class="cn.hhit.gwap.action.main.BookListAction" scope="prototype">
            
    <property name="categoryDAO">
                
    <ref bean="categoryDAO"/>
            
    </property>
        
    </bean>

           
    <bean id="categoryAction" class="cn.hhit.gwap.action.main.CategoryAction" scope="prototype">
            
    <property name="categoryDAO">
                
    <ref bean="categoryDAO"/>
            
    </property>
        
    </bean>

         
    <bean id="logoutAction" class="cn.hhit.gwap.action.main.LogoutAction" scope="prototype"></bean>

         
    <bean id="shoppingAction" class="cn.hhit.gwap.action.main.ShoppingAction" scope="prototype">
            
    <property name="productDAO">
                
    <ref bean="productDAO"/>
            
    </property>
        
    </bean>

        
    <!--order部分-->
          
    <bean id="addrAction" class="cn.hhit.gwap.action.order.AddrAction" scope="prototype">
            
    <property name="addressDAO">
                
    <ref bean="addressDAO"/>
            
    </property>
             
    <property name="itemDAO">
                
    <ref bean="itemDAO"/>
            
    </property>
              
    <property name="orderDAO">
                
    <ref bean="orderDAO"/>
            
    </property>
        
    </bean>

          
    <bean id="orderAction" class="cn.hhit.gwap.action.order.OrderAction" scope="prototype">
            
    <property name="addressDAO">
                
    <ref bean="addressDAO"/>
            
    </property>
        
    </bean>

          
    <bean id="orderItemViewAction" class="cn.hhit.gwap.action.order.OrderItemViewAction" scope="prototype">
             
    <property name="itemDAO">
                
    <ref bean="itemDAO"/>
            
    </property>
        
    </bean>

         
    <bean id="orderViewAction" class="cn.hhit.gwap.action.order.OrderViewAction" scope="prototype">
              
    <property name="orderDAO">
                
    <ref bean="orderDAO"/>
            
    </property>
        
    </bean>

        
    <!--cart部分-->
         
    <bean id="showCartAction" class="cn.hhit.gwap.action.cart.ShowCartAction" scope="prototype"></bean>

    </beans>

    spring-jdbc.properties
    jdbc.driver=com.mysql.jdbc.Driver
    jdbc.url
    =jdbc:mysql://127.0.0.1:3306/gwap
    jdbc.username
    =root
    jdbc.password
    =123456

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

    <!DOCTYPE struts PUBLIC
            "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
            "http://struts.apache.org/dtds/struts-2.1.dtd"
    >

    <struts>
        
    <include file="struts-main.xml" />
        
    <include file="struts-user.xml" />
        
    <include file="struts-order.xml" />
        
    <include file="struts-cart.xml" />
    <!--用到json必須繼承"json-default"-->
        
    <package name="gwap-default" extends="json-default">
            
    <global-results>
                
    <result>/WEB-INF/jsp/fail.jsp</result>
            
    </global-results>
        
    </package>
    </struts>

    struts-main.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
        "http://struts.apache.org/dtds/struts-2.1.7.dtd"
    >

    <struts>
        
    <package name="dang-main" namespace="/main" extends="gwap-default">
            
    <action name="index">
                
    <result>/WEB-INF/jsp/main/main.jsp</result>
            
    </action>

            
    <action name="login">
               
    <result type="redirectAction">
                    
    <param name="actionName">index</param>
                    
    <param name="namespace">/user</param>
                
    </result>
            
    </action>

            
    <action name="logout" class="logoutAction">
                
    <result name="success">/WEB-INF/jsp/main/main.jsp</result>
                
    <result name="next"  type="json"></result>
            
    </action>

            
    <action name="detail" class="bookDetailAction">
                
    <result name="success">/WEB-INF/jsp/main/book_detail.jsp</result>
            
    </action>

            
    <action name="category" class="categoryAction">
                
    <result name="success">/WEB-INF/jsp/main/category.jsp</result>
            
    </action>

            
    <action name="booklist" class="bookListAction">
                
    <param name="size">5</param>
                
    <result  name="success">/WEB-INF/jsp/main/book_list.jsp</result>
            
    </action>

            
    <action name="shopping" class="shoppingAction">
               
    <result type="json"></result>
            
    </action>
        
    </package>
    </struts>

    posted on 2011-03-25 16:24 Mr.lu 閱讀(9690) 評論(11)  編輯  收藏

    評論

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2011-11-25 09:52 龍戰

    不能下,http://m.tkk7.com/luyongfa/admin/Files.aspx是你的后臺吧
      回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2012-05-28 21:29 gfdf

    很完整,好  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2012-08-04 16:38 592010803@qq.com

    能給個源碼不  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2012-08-04 17:58 592010803@qq.com

    可以把這個項目的源碼給我么 上面有我的QQ郵箱  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架[未登錄] 2013-01-07 11:58 小張

    把這個項目的源代碼發我郵箱吧~!
    sarsuki2012@163.com
    謝謝!  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2013-11-23 11:08 孫英凱

    求一個完整工程  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2014-11-04 09:43 合格

    不是完整的差評  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2014-11-21 00:50 不合格

    發那么多沒用的action配置,你的事務配置呢  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2014-11-27 13:31 hibernate

    能給源代碼嗎 謝謝 532789258@qq.com  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2015-04-17 15:44 947954418@qq.com

    可以給個完整代碼嗎  回復  更多評論   

    # re: SSI整合--搭建Struts2+Spring+Ibatis框架 2015-05-23 17:59 Juan

    有好多警告,什么原因  回復  更多評論   


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 精品国产免费观看久久久| 国产大片免费网站不卡美女| 国产精品高清全国免费观看| 亚洲另类自拍丝袜第1页| 国产精品免费高清在线观看| 永久免费精品影视网站| 国产无遮挡裸体免费视频| 亚洲av无码专区在线观看亚| 成人黄软件网18免费下载成人黄18免费视频 | 狼群影院在线观看免费观看直播| 亚洲国产精品久久久久网站| 十八禁无码免费网站| 亚洲视频精品在线观看| 免费观看激色视频网站(性色)| 亚洲av无码电影网| 午夜毛片不卡高清免费| 在线观看亚洲免费视频| 亚洲国产小视频精品久久久三级 | 久久国产精品成人免费| 亚洲精品高清久久| 久久精品免费一区二区| 久久亚洲精品国产亚洲老地址| 日本不卡视频免费| igao激情在线视频免费 | 91热久久免费精品99| 亚洲制服丝袜中文字幕| 日本免费福利视频| 国产免费一级高清淫曰本片| 亚洲bt加勒比一区二区| 老司机在线免费视频| 亚洲Av无码专区国产乱码DVD| 国产亚洲综合视频| 亚洲综合无码AV一区二区| 91av免费观看| 亚洲av中文无码乱人伦在线观看| gogo全球高清大胆亚洲| 很黄很污的网站免费| 亚洲午夜精品在线| 亚洲福利在线播放| 6080午夜一级毛片免费看6080夜福利| 亚洲日本一线产区和二线 |