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 閱讀(873) 評論(1)  編輯  收藏

          評論

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

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

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 芜湖市| 和田县| 巴塘县| 犍为县| 清新县| 南漳县| 万荣县| 镇远县| 武强县| 麦盖提县| 奈曼旗| 永和县| 栾城县| 沅陵县| 桐庐县| 安龙县| 宁晋县| 百色市| 南投县| 通州区| 调兵山市| 岗巴县| 专栏| 凌海市| 东海县| 胶南市| 遂宁市| 永平县| 昆明市| 宣汉县| 蓬安县| 青神县| 浏阳市| 错那县| 高要市| 图们市| 鄂伦春自治旗| 剑川县| 颍上县| 天峻县| 茶陵县|