<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去哪找數(shù)據(jù)庫的配置信息,因為有此Bean才出現(xiàn)下面用${}標記來取變量的語句-->
        
    <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            
    <property name="locations">
                
    <list>
                    
    <value>classpath:spring-jdbc.properties</value>
                
    </list>
            
    </property>
        
    </bean>

        
    <!--配置一個數(shù)據(jù)源,根據(jù)上面propertyConfig指定的location去找數(shù)據(jù)庫連接的配置信息-->
        
    <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>

        
    <!--根據(jù)dataSource和configLocation創(chuàng)建一個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>


        
    <!--根據(jù)sqlMapClien創(chuàng)建一個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" />
    <!--用到j(luò)son必須繼承"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 閱讀(9684) 評論(11)  編輯  收藏

    評論

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

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

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

    很完整,好  回復(fù)  更多評論   

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

    能給個源碼不  回復(fù)  更多評論   

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

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

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

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

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

    求一個完整工程  回復(fù)  更多評論   

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

    不是完整的差評  回復(fù)  更多評論   

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

    發(fā)那么多沒用的action配置,你的事務(wù)配置呢  回復(fù)  更多評論   

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

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

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

    可以給個完整代碼嗎  回復(fù)  更多評論   

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

    有好多警告,什么原因  回復(fù)  更多評論   


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


    網(wǎng)站導(dǎo)航:
     
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(2)

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 久久福利青草精品资源站免费| 午夜影院免费观看| 亚洲国产精品美女久久久久| 亚洲免费在线观看视频| 亚洲精品视频在线播放| 国产精品极品美女免费观看| 在线免费视频一区| 精品免费国产一区二区| 在线视频免费国产成人| 国产成人高清精品免费鸭子| 国产免费观看视频| 国产成人高清精品免费鸭子| 亚洲成av人片一区二区三区| 亚洲精品成人久久久| 2022中文字字幕久亚洲| 亚洲中文字幕在线第六区| 国外成人免费高清激情视频| 免费观看a级毛片| 国产精品成人无码免费| 亚洲AV无码不卡在线观看下载| 国产偷窥女洗浴在线观看亚洲| 国产午夜亚洲精品午夜鲁丝片| 久久亚洲国产午夜精品理论片| 国产国产成年年人免费看片| 免费大黄网站在线观看| 久久久久亚洲av成人无码电影 | 亚洲免费人成在线视频观看| 久久久久久AV无码免费网站| 亚欧人成精品免费观看| 天天干在线免费视频| 无码专区一va亚洲v专区在线| 日韩视频在线精品视频免费观看 | 亚洲一区中文字幕| 一区二区三区亚洲| 亚洲自国产拍揄拍| 美女又黄又免费的视频| a成人毛片免费观看| 亚洲AV无码成人网站在线观看| 精品免费AV一区二区三区| 91成人免费观看在线观看| 麻花传媒剧在线mv免费观看|