2013年7月16日

摘要: 2011-11-08 16:29web.xml中配置Spring中applicationContext.xml的方式使用web.xml方式加载Spring时,获取Spring applicationContext.xml的方式1、servlet方式加载:【web.xml】 dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:applicationContext.xml 2、listener方式加载:【web.xml】在web.xml里配置List. 阅读全文
posted @ 2013-07-16 19:23 世界之大追梦者 阅读(2016) 评论(0) 推荐(0) 编辑
摘要: web.xml中classpath:和classpath*:IccBoYapplicationContext.xml 配置文件的存放位置web.xml中classpath:和classpath*:有什么区别?classpath:只会到你的class路径中查找找文件;classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找.存放位置:1:src下面需要在web.xml中定义如下:contextConfigLocationclasspath:applicationContext.xml2:WEB-INF下面需要在web.xml中定义如下:contextConfig 阅读全文
posted @ 2013-07-16 19:06 世界之大追梦者 阅读(2264) 评论(0) 推荐(0) 编辑
摘要: 1.context-param 元素用来设定web站台的环境参数(context),它包含两个子元素:param-name和param-value.参数名称设定Context名称值设定Context名称的值范例: param_name param_value此所设定的参数,在JSP网页中可以使用下列方法来取得:${initParam.param_name}若在Servlet可以使用下列方法来获得:String param_name=getServletContext().getInitParamter("param_name");2.filter元素用来声明filter的相 阅读全文
posted @ 2013-07-16 15:08 世界之大追梦者 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 在SSH集成的前提下。某些情况我们需要在Action以外的类中来获得Spring所管理的Service对象。 之前我在网上找了好几好久都没有找到合适的方法。例如: ApplicationContext context = new ClassPathXmlApplicationContext(); 当时我觉得没有这个必要,浪费内存。后来我终于想出了一个解决方法。在此拿来给大家参考下,希望对大家有帮助。 1.创建一个类并让其实现org.springframework.context.ApplicationContextAware接口来让Spring在启动的时候为我们注入Applic... 阅读全文
posted @ 2013-07-16 14:33 世界之大追梦者 阅读(477) 评论(0) 推荐(0) 编辑

导航