samtiger


          QQ:418148757
          Name:yangchuan
          數(shù)據(jù)加載中……
          spring+struts1+hibernate的三種方式

              首先說一下struts1加載spring的兩種方式:
               第一種:通過web.xml配置加載spring上下文環(huán)境,其配置方式如下:
               web.xml

               <context-param>
                  <param-name>contextConfigLocation</param-name>
                  <param-value>/WEB-INF/applicationContext.xml</param-value>
                </context-param>

           通過listener加載
                <listener>
                      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
                </listener>

             或者利用severlet類加載
               
                  <servlet>
                      <servlet-name>context</servlet-name> 
                      <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
                      <load-on-startup>1</load-on-startup> 
                  </servlet>
          第二種方式:
                  使用Struts插件 
                 在struts-config.xml中
               <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
                  <set-property property="contextConfigLocation"
                      value="/WEB-INF/applicationContext.xml"/>
              </plug-in>

          這兩種配置的明顯區(qū)別就是,第一種方式可以配置多個spring配置文件。而且第一種方式應(yīng)該說是web容器加載spring的方式

          posted on 2007-09-28 23:15 sam.chuan.yang 閱讀(876) 評論(1)  編輯  收藏

          評論

          # re: spring+struts1+hibernate的三種方式 2007-09-29 07:57 BeanSoft

          thanks!
            回復(fù)  更多評論    

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


          網(wǎng)站導(dǎo)航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 南阳市| 麻栗坡县| 扬中市| 措美县| 蛟河市| 北川| 瑞昌市| 五峰| 庆元县| 北票市| 调兵山市| 余干县| 德格县| 肇庆市| 上思县| 永州市| 仪征市| 北安市| 乌兰察布市| 麻栗坡县| 云龙县| 上饶市| 康保县| 中山市| 乌审旗| 鹿邑县| 交口县| 新宁县| 威宁| 休宁县| 焦作市| 策勒县| 泰州市| 旌德县| 汝州市| 名山县| 合阳县| 雅安市| 安乡县| 乳山市| 东兴市|