I'm happy to live!

          Develop with pleasure!

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            39 隨筆 :: 2 文章 :: 31 評論 :: 0 Trackbacks
          今天做個spring和struts的集成Demo,我用的是myeclipse6.5,導入spring框架和struts框架都相當方便,一切就序后,開tomcat,跑吧,相當的不爽,第一個鏈接就爆: servlet action is not available,什么意思啊,難道我的配置文件沒配對?檢查了沒天也沒發現什么問題.
          以下是我的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>

          看了又看找了又找,還是沒看出問題,把struts-config中關于spring兩段配置去掉后,單跑struts是沒問題的,看來很有可能myeclipse沒把包導全啊,可能沒找到,發現好多人都中過此招,有些包沒找到spring的代理請求處理類或者是沒找到初始化spring上下文的插件類,這兩個類都在spring.jar中,于是把這個jar包放入lib目錄中去,重啟tomcat... ... 再點,ok,終于到應該去的地方了.
          posted on 2008-12-04 17:19 Norsor 閱讀(567) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 福建省| 宜兰县| 唐山市| 广安市| 招远市| 河北省| 龙门县| 阳城县| 淳安县| 湘乡市| 香格里拉县| 南漳县| 万山特区| 芒康县| 唐山市| 镇安县| 改则县| 延川县| 武隆县| 兰考县| 罗山县| 虎林市| 任丘市| 长宁县| 武夷山市| 锡林郭勒盟| 驻马店市| 溧水县| 图木舒克市| 涪陵区| 昆山市| 浠水县| 巴塘县| 潞城市| 丰顺县| 冕宁县| 南部县| 镇巴县| 景东| 哈密市| 叶城县|