I'm happy to live!

          Develop with pleasure!

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            39 隨筆 :: 2 文章 :: 31 評(píng)論 :: 0 Trackbacks
          今天做個(gè)spring和struts的集成Demo,我用的是myeclipse6.5,導(dǎo)入spring框架和struts框架都相當(dāng)方便,一切就序后,開(kāi)tomcat,跑吧,相當(dāng)?shù)牟凰谝粋€(gè)鏈接就爆: servlet action is not available,什么意思啊,難道我的配置文件沒(méi)配對(duì)?檢查了沒(méi)天也沒(méi)發(fā)現(xiàn)什么問(wèn)題.
          以下是我的struts  的struts-config.xml:
          <struts-config>
              
          <data-sources />
              
          <form-beans />
              
          <global-exceptions />
              
          <global-forwards />

              
          <action-mappings>
                  
          <action path="/hello" type="com.laxxx.struts.action.Hello">
                      
          <forward name="hello" path="/hello.jsp" />
                  
          </action>
              
          </action-mappings>

              
          <controller
                  
          processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />


              
          <message-resources
                  
          parameter="com.laxxx.struts.ApplicationResources" />


              
          <plug-in
                  
          className="org.springframework.web.struts.ContextLoaderPlugIn">

                  
              
          <set-property property="contextConfigLocation"
                      value
          ="/WEB-INF/applicationContext.xml" />
              
          </plug-in>
          </struts-config>

          以下是spring的applicationContext.xml:
          <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-2.5.xsd">

              
          <bean name="/hello" class="com.laxxx.struts.action.Hello">

              
          </bean>
          </beans>

          看了又看找了又找,還是沒(méi)看出問(wèn)題,把struts-config中關(guān)于spring兩段配置去掉后,單跑struts是沒(méi)問(wèn)題的,看來(lái)很有可能myeclipse沒(méi)把包導(dǎo)全啊,可能沒(méi)找到,發(fā)現(xiàn)好多人都中過(guò)此招,有些包沒(méi)找到spring的代理請(qǐng)求處理類或者是沒(méi)找到初始化spring上下文的插件類,這兩個(gè)類都在spring.jar中,于是把這個(gè)jar包放入lib目錄中去,重啟tomcat... ... 再點(diǎn),ok,終于到應(yīng)該去的地方了.
          posted on 2008-12-04 17:19 Norsor 閱讀(564) 評(píng)論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 双柏县| 南和县| 苏尼特右旗| 邯郸市| 仁寿县| 奈曼旗| 阿城市| 吉林省| 青岛市| 于都县| 五常市| 红桥区| 渝北区| 黄浦区| 察隅县| 虎林市| 迭部县| 江源县| 渝北区| 凌源市| 察雅县| 高唐县| 枣强县| 镇平县| 措勤县| 克什克腾旗| 丹巴县| 藁城市| 凉城县| 靖宇县| 松江区| 克什克腾旗| 明溪县| 新昌县| 汶上县| 富裕县| 肃宁县| 陆川县| 政和县| 台南市| 湖南省|