文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > context-param与init-param的区别与作用
侵权投诉

context-param与init-param的区别与作用

第一种参数在servlet里面可以通过getServletContext().getInitParameter("context/param")得到 第二种参数只能在servlet的init()方法中通过this.getInitParameter("param1")取得.

context-param与init-param的区别与作用

context-param元素含有一对参数名和参数值,用作应用的

ServletContext上下文初始化参数。参数名在整个Web应用中必须是惟一的。

<!ELEMENT context-param (param-name, param-value,

description?)>

<!ELEMENT param-name (#PCDATA)>

<!ELEMENT param-value (#PCDATA)>

<!ELEMENT description (#PCDATA)>

编辑本段描述参数

param-name 子元素包含有参数名,而param-value子元素包含的是参数值。作为选择,可用description子元素来描述参数。

下面是一个含有context-param元素的有效部署描述符:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" <web-app> <context-param> <param-name>jdbcDriver</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> </web-app>

The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets

上一页第4页

你可能喜欢

热门文档

相关文档

  • web.xml中的参数context-param和init-param区别

    web.xml中的参数context-param和init-param区别_IT/计算机_专业资料。web.xml...web.xml 中的参数 context-param 和 init-param 区别 2010-03-15 09:15:39...

  • ContextLoaderListener监听器与context-prama标记的使用

    监听器与context-prama标记的使用_IT/计算机_专业...ContextLoaderListener 的作用就是启动 Web 容器时,...<context-param> <param-name>contextConfigLocation...

  • init()与service()区别

    init()与service()区别_计算机软件及应用_IT/计算机_专业资料。servlet中init(...context-param与init-pa... 13页 免费 web project和web servi... 5页 免费...

  • web.xml的解析

    的init()方法中通过this.getInitParameter("param1"...ServletContext(); context-param的值 = ...但是他们并不同 <context-param>是application范围内...

  • 企业级java1

    (不同作用域数据的比 较),访问应用程序级初始化参数(context-param 与 init-param 比较),将消息记录到 应用程序日志文件中; Servlet 通信:向浏览器发送错误消息...

  • 答案

    Detached状态和Transient状态的区别在于Detached状态的...()的作用是将数据库与缓存中的数据同步 11题:...<context-param> <param-name>contextConfigLocation...

  • Spring-MVC_v2

    -param> <param-name>contextConfigLocation</param-...视图 视图的作用是渲染模型数据,将模型里的数据以...为逻辑视图名的解析提供了不同的策略,可以在 Spring...

  • Servlet高级篇_IT/计算机_专业资料

    Servlet高级部分 说明我们今天讲的大部分是Servlet比较...init()方法 Init的作用? Init()方法 public void...servletContext 取得初始参数配置: <context-param> ...

  • Servlet

    两者的区别;画图演示,说明道理 Servlet实例 ? 实现...Init的作用? Init()方法 public void init(){ ?...context-param ServletContext对象 ? 与资源相关的...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email