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

做网站费是多少广州那家做网站最好

做网站费是多少,广州那家做网站最好,那有做网站的,网络营销的发展趋势和前景目录 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_LOCATION="ContextConfigLocation";@Overridepublic void contextInitialized(ServletContextEvent servletContextEvent) {ServletContext servletContext = servletContextEvent.getServletContext();String initParameter = servletContext.getInitParameter(CONTEXT_CONFIG_LOCATION);
//        initParameter=initParameter.substring("classpath".length());//1.创建Spring容器ApplicationContext applicationContext=new 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的坐标

    <dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>5.2.5.RELEASE</version></dependency><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<!--    定义全局参数  --><context-param><param-name>contextClass</param-name><param-value>com.xfy.config.MyxfyApplicationContext</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
</web-app>

 

MVC框架思想及其设计思路

 

 

http://www.yayakq.cn/news/285337/

相关文章:

  • 海南网站建设公司长春制作网站哪家好
  • 房产集团公司网站建设方案网站免费正能量小说
  • 中山营销型网站建设国外唯美flash个人网站欣赏
  • 上海如何批量建站江门网站制作方案定制
  • 国外优秀的网站用旧手机做网站
  • 专注大连网站建设建设部网站如何下载规范 标准
  • 学院宣传网站制作重庆工商大学
  • 做网站在哪买域名互联网推广方案怎么写
  • 太原建设工程信息网站模板建站平台
  • 简易网站模板建筑人才网证书查询
  • 深圳讯美网站建设一级造价师停考最新消息
  • 网站再就业技能培训班阆中网站网站建设
  • 哈尔滨市建设工程质量安全站dw做的网站放文件夹
  • 公司网站的建设流程今天军事新闻最新消息中国
  • 南昌中小企业网站制作优化大师最新版本
  • 网站首页site不到 a5怎么制作表白网页
  • 环评在那个网站做logo神器免费版
  • 苏州专业高端网站建设网络公司中文 网站模板
  • Python电影网站开发网站建设模板价格
  • app网站搭建温州市网站制作哪家便宜
  • 广东网站建设找官网建设目的
  • 海口网站制作网站美化公司
  • 免费seo网站的工具wordpress显示文章列表的主题
  • 网站建设对企业的重要性广饶网站设计
  • 黄村网站建设网站建设优化加盟代理
  • 网站建站六个目标网站建设总费用
  • 怎么上网站做简易注销的步骤网页设计代码信件怎么写
  • 宏福建设集团有限公司网站上海网站建设软件下载
  • 获取网站访客qq代码刷网站关键词排名原理
  • 手机网站和电脑网站的区别如何做cad图纸模板下载网站