Java 应用系统开发 - ServletContext 和 Web 配置大纲 Web 应用环境对象 Java EE Web 的配置 Servlet 配置对象 转发和重定向 本节习题 Java 应用系统开发 ServletContext 和 Web 配置 王晓东 wangxiaodong@ouc.edu.cn 中国海洋大学 November 26, 2018 大纲 Web 应用环境对象 Java EE Web 的配置 Servlet 配置对象 转发和重定向 本节习题 学习目标 Java EE Web 应用需要部署在符合 Java EE 规范的 Web 容器中 运行,如何取得 Web 应用本身的信息在编程中非常重要。 1. 掌握 Web 应用对象 ServletContext。 2. 了解 Web 应用的配置方法。 3. 掌握 MVC 模式 Web 开发中发挥核心作用的转发,区别转 发与重定向。 大纲 Web 应用环境对象 Java EE Web 的配置 Web 应用创建一个表达 Web 应用环境的对象(即 ServletContext 对象),并将 Web 应用的基本信息存储在这个 ServletContext 对象中。 O Web 应用环境对象的用途 ▶ 所有 Web 组件都可以访问此 ServletContext 对象,进而取 得 Web 应用的基本信息。 ▶ ServletContext 还可以作为整个 Web 应用的共享容器对象, 能够被所有会话请求共用,保存0 码力 | 33 页 | 668.91 KB | 1 年前3
Java 应用与开发 - Java EE 监听器编程监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 Java 应用与开发 Java EE 监听器编程 王晓东 wangxiaodong@ouc.edu.cn 中国海洋大学 December 3, 2018 大纲 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 大纲 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 大纲 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 对象属性监听器 本节习题 接下来⋯ 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 大纲 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 什么是监听器 监听器,顾名思义就是能监测其他对象活动的对象,当被监测的 对象0 码力 | 22 页 | 549.84 KB | 1 年前3
《Java 应用与开发》课程讲义 - 王晓东19.5 课后习题 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 20 ServletContext 和 Web 配置 251 20.1 Web 应用环境对象 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 22.3 ServletContext 对象监听器 . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 22.4 ServletContext 对象属性监听器 . . . . . . . . . . . . . . . . . . . . . 以使外界能够获取该类的实例,达到全局可 见的效果。 在任何使用到 Single 类的 Java 程序中(这里指的是一次运行中),需要确保只有一 个 Single 类的实例存在(如 Web 应用 ServletContext 全局上下文对象),则使用该模式。 5.4 关键字 final 在声明 Java 类、变量和方法时可以使用关键字 final 来修饰,以使其具有“终态” 的特性: 1. final0 码力 | 330 页 | 6.54 MB | 1 年前3
Spring Framwork Web on Servlet Stack v5.3.36 SNAPSHOTizer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) { // Load Spring web application configuration AnnotationConfigWebApplicationContext servlet = new DispatcherServlet(context); ServletRegistration.Dynamic registration = servletContext.addServlet("app", servlet); registration.setLoadOnStartup(1); registration.a MyWebApplicationInitializer : WebApplicationInitializer { override fun onStartup(servletContext: ServletContext) { // Load Spring web application configuration val context = Annot0 码力 | 259 页 | 3.58 MB | 1 年前3
Spring Framework 1.2.8 Changelog* added overloaded constructors to MockFilterConfig, using a MockServletContext instead of a ServletContext argument Package org.springframework.orm * refined JDO PersistenceManagerFactoryUtils to explicitly even after a forward/include * added various RequestLoggingFilters: for Commons Logging, the ServletContext log, and Log4J including NDC support * FrameworkServlet exposes protected "processRequest" method Log4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system0 码力 | 89 页 | 254.65 KB | 1 年前3
Spring Framework 1.2.x Changelog* added overloaded constructors to MockFilterConfig, using a MockServletContext instead of a ServletContext argument Package org.springframework.orm * refined JDO PersistenceManagerFactoryUtils to explicitly even after a forward/include * added various RequestLoggingFilters: for Commons Logging, the ServletContext log, and Log4J including NDC support * FrameworkServlet exposes protected "processRequest" method Log4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system0 码力 | 94 页 | 267.57 KB | 1 年前3
Spring Framework 1.1.4 ChangelogLog4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system ServletContextFactoryBean, exposing the ServletContext for bean references (alternative to ServletContextAware) * added ServletContextAttributeFactoryBean, exposing an existing ServletContext attribute for bean references references * added ServletContextAttributeExporter, taking Spring-defined objects and exposing them as ServletContext attributes * added ServletContextPropertyPlaceholderConfigurer, a subclass that falls back to0 码力 | 54 页 | 157.26 KB | 1 年前3
Spring Framework 1.2.5 Changelogeven after a forward/include * added various RequestLoggingFilters: for Commons Logging, the ServletContext log, and Log4J including NDC support * FrameworkServlet exposes protected "processRequest" method Log4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system ServletContextFactoryBean, exposing the ServletContext for bean references (alternative to ServletContextAware) * added ServletContextAttributeFactoryBean, exposing an existing ServletContext attribute for bean references0 码力 | 79 页 | 226.37 KB | 1 年前3
Spring Framework 1.1.5 ChangelogLog4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system ServletContextFactoryBean, exposing the ServletContext for bean references (alternative to ServletContextAware) * added ServletContextAttributeFactoryBean, exposing an existing ServletContext attribute for bean references references * added ServletContextAttributeExporter, taking Spring-defined objects and exposing them as ServletContext attributes * added ServletContextPropertyPlaceholderConfigurer, a subclass that falls back to0 码力 | 57 页 | 166.71 KB | 1 年前3
Spring Framework 1.1.5 Referencestart up a Spring root application context via its ContextLoaderListener, and access it via its ServletContext attribute (or Spring's respective helper method) from within a Struts or WebWork action. Note knows to which servlet it is associated (by having a link to the ServletContext). The WebApplicationContext is bound in the ServletContext, and using RequestContextUtils you can always lookup the WebApplicationContext "command.address.street". The bind macro assumes the default HTML escaping behavior specified by the ServletContext parameter defaultHtmlEscape in web.xml The optional form of the macro called #springBindEscaped0 码力 | 223 页 | 1.22 MB | 1 年前3
共 324 条
- 1
- 2
- 3
- 4
- 5
- 6
- 33













