<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" />
    <!--用到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 閱讀(9684) 評論(11)  編輯  收藏

    評論

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

    不能下,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 小張

    把這個項目的源代碼發(fā)我郵箱吧~!
    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 不合格

    發(fā)那么多沒用的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

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


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


    網(wǎng)站導航:
     
    <2013年1月>
    303112345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導航

    統(tǒng)計

    常用鏈接

    留言簿(2)

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲国产成AV人天堂无码| 亚洲AV无码欧洲AV无码网站| 免费国产污网站在线观看| 亚洲另类自拍丝袜第五页| 亚洲人成影院在线无码按摩店| 四虎在线最新永久免费| 国产精品黄页免费高清在线观看| 67194在线午夜亚洲| 噼里啪啦电影在线观看免费高清 | 中文字幕看片在线a免费| 亚洲精品国产高清嫩草影院| 色哟哟国产精品免费观看| 久久久久久亚洲精品影院| 亚洲黄色在线播放| 亚洲va久久久噜噜噜久久| 久久精品国产亚洲Aⅴ蜜臀色欲| 在线观看免费精品国产| 国产亚洲精彩视频| 亚洲欧美aⅴ在线资源| 亚洲免费观看在线视频| 亚洲免费在线播放| 亚洲AV无码成人精品区天堂| 久久亚洲精品无码观看不卡| 亚洲国产综合精品中文字幕| 亚洲精品第一国产综合境外资源| 日本一道本高清免费| 午夜免费福利在线| 免费看AV毛片一区二区三区| 最新猫咪www免费人成| 成年女人午夜毛片免费视频| 成人免费毛片内射美女-百度| 在线视频免费观看爽爽爽| 免费h片在线观看网址最新| 亚洲精品免费在线| 国产人在线成免费视频| 美女被cao免费看在线看网站| 日韩欧毛片免费视频| 毛片网站免费在线观看| 免费爱爱的视频太爽了| 国产大片91精品免费观看男同| 国产99视频精品免费视频7|