隨筆-13  評論-9  文章-9  trackbacks-0
          1.web.xml

          監聽器
          ?<listener>
          ??????? <listener-class>
          ??????????? org.springframework.web.context.ContextLoaderListener
          ??????? </listener-class>
          ??? </listener>

          在servlet上下文配置spring的配置文件
          ?<context-param>
          ??????? <param-name>contextConfigLocation</param-name>
          ??????? <param-value>
          ??????????? /WEB-INF/config/hibernate/applicationContext-hibernate.xml
          ??????????? /WEB-INF/config/spring/applicationContext-spring.xml
          ??????????? <!--/WEB-INF/config/spring/acegi-security-common.xml-->
          ??????? </param-value>
          ??? </context-param>

          2.得到Spring Bean
          ?? public class test extends action
          ?{
          ?? private static ApplicationContext ctx = null;
          ?? public Object getBean(String name)
          ?? if(ctx == null)
          ??????? {
          ??????????? ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
          ??????? }
          ??????? return ctx.getBean(name);
          ??? }
          }
          posted on 2006-06-19 14:44 Dragonofson 閱讀(558) 評論(0)  編輯  收藏 所屬分類: Spring
          主站蜘蛛池模板: 荃湾区| 揭东县| 宜宾县| 大同市| 元阳县| 浦东新区| 宁晋县| 民县| 六枝特区| 都江堰市| 镇沅| 伊宁县| 南郑县| 贺州市| 海丰县| 奉新县| 土默特右旗| 鹰潭市| 佳木斯市| 永和县| 弥渡县| 沙洋县| 河间市| 资阳市| 三门县| 黄陵县| 金乡县| 孟村| 颍上县| 伽师县| 南城县| 日土县| 前郭尔| 武清区| 长岛县| 雷波县| 三穗县| 庆城县| 金塔县| 高碑店市| 辽中县|