当前位置: 首页 > news >正文

西安建站推广西安学校网站建设报价

西安建站推广,西安学校网站建设报价,青岛出版集团网站,devmyapp目录 Javaweb三大组件及环境特点 Spring整合web环境的思路及实现 Spring的web开发组件spring-web MVC框架思想及其设计思路 Javaweb三大组件及环境特点 Spring整合web环境的思路及实现 package com.xfy.listener;import com.xfy.config.SpringConfig; import org.springfra…目录 Javaweb三大组件及环境特点 Spring整合web环境的思路及实现 Spring的web开发组件spring-web MVC框架思想及其设计思路 Javaweb三大组件及环境特点 Spring整合web环境的思路及实现 package com.xfy.listener;import com.xfy.config.SpringConfig; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener;public class ContextLoaderListenter implements ServletContextListener {private String CONTEXT_CONFIG_LOCATIONContextConfigLocation;Overridepublic void contextInitialized(ServletContextEvent servletContextEvent) {ServletContext servletContext servletContextEvent.getServletContext();String initParameter servletContext.getInitParameter(CONTEXT_CONFIG_LOCATION); // initParameterinitParameter.substring(classpath.length());//1.创建Spring容器ApplicationContext applicationContextnew ClassPathXmlApplicationContext(initParameter);//2.将容器存入ServletContext中servletContext.setAttribute(applicationContext,applicationContext);}Overridepublic void contextDestroyed(ServletContextEvent servletContextEvent) {} }public class WebAppLicationContext {public static ApplicationContext getWebAppLicationContext(ServletContext servletContext){ApplicationContext applicationContext (ApplicationContext) servletContext.getAttribute(applicationContext);return applicationContext;} }WebServlet(urlPatterns /accountServlet) public class AccountServlet extends HttpServlet {Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {ApplicationContext applicationContext WebAppLicationContext.getWebAppLicationContext(request.getServletContext());AcountService bean applicationContext.getBean(AcountService.class);bean.transforMoney(tom,lucy,500);} Spring的web开发组件spring-web Spring其实已经为我们定义好了一个ContextLoaderListener使用方式跟我们上面自己定义的大体一样 先导入Spring-web的坐标 dependencygroupIdorg.springframework/groupIdartifactIdspring-web/artifactIdversion5.2.5.RELEASE/version/dependencylistenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listener ?xml version1.0 encodingUTF-8? web-app !-- 定义全局参数 --context-paramparam-namecontextClass/param-nameparam-valuecom.xfy.config.MyxfyApplicationContext/param-value/context-paramlistenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listener /web-app MVC框架思想及其设计思路
http://www.hkea.cn/news/14185588/

相关文章:

  • 自动推广引流app多产品的网站怎么做seo
  • 凡科建站网网架公司招聘施工队伍
  • seo网站结构wordpress 学习群
  • 第一ppt网站官网计算机动漫制作专业
  • 网站建设海外淘宝客模板wordpress
  • 网站推广seo代理网站网站建设方案书怎么写
  • 网站建设常规尺寸如何免费创建一个自己的网站
  • 网站建设app开发销售好做吗盐城网站开发市场
  • 淘宝网站域名网络营销产品概念
  • 许昌市网站开发asp.net网站开发简明教程
  • 网站后台 行间距调整手机网站 代码
  • 网站目录结构图网站开发后怎么上线
  • 试用网站模版2024新冠又来了
  • 网站建设与管理asp北京城乡建设部网站首页北京
  • 太原市建设北路小学网站黑龙江龙采做网站如何
  • 公众号网站免费的建站平台
  • python 可以做网站吗建筑师网站有哪些
  • 云服务器 部署网站空间放两个网站
  • 校园网站制作wordpress 谷歌地图
  • 网站提现功能开发自己做的网站怎么调用百度地图
  • 网站建设公司效益怎么样长沙发布全市
  • 免费网站app代码CC wordpress 攻击
  • 南宁哪里有做网站的公司中小企业网站建设与管理课后答案
  • 个人免费注册公司网站内在空间官网
  • 兰甘肃网站建设肇庆做网站公司
  • 网站建设类的职位做网站前端
  • 网站打开风险怎么解决盐城永祥建设有限公司网站
  • 广东省建设厅官方网站网址电子商务网站推广的方式有哪些
  • 免费 网站 服务器论坛网站制作
  • 公司推广做哪个网站wordpress作者编辑