标签库使用指南1-Application标签库

本文档介绍了JSP中的Application Tag Library,包括如何引入标签库,以及详细讲解了attribute、attributes、equalsAttribute、existsAttribute、removeAttribute、setAttribute、initParameter、initParameters、equalsInitParameter和existsInitParameter等标签的使用方法和示例,帮助开发者访问和操作JSP应用的ApplicationContext信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> 1. Application Tag Library APPLICATION标签库中包含的标签用来访问JSP应用中的所有ApplicationContext信息。 1.1 使用指南: (1) 将标签库描述文件application.tld拷贝到/WEB-INF目录下; (2) 将标签库JAR文件拷贝到/WEB-INF/lib目录下; (3) 在/WEB-INF/web.xml文件中加入配置信息: http://jakarta.apache.org/taglibs/application-1.0 /WEB-INF/application.tld (4) 在使用标记库的JSP文件中加入引用信息: 1.2 标签说明 1.2.1 Application属性标签 标签名 attribute Tag Body empty 作用 得到application中某个属性的值 使用示例 示例说明 输出application中名为test1的属性的值。 标签名 attributes Tag Body JSP 作用 遍历application中所有的属性或得到特定属性的值 使用示例 Name: Value: 示例说明 输出application中所有属性的名称和值。 使用示例 Name: Value: 示例说明 输出application中属性myatt的名称和值。 标签名 equalsAttribute Tag Body JSP 作用 判断application中属性的值是否与指定值相等。 使用示例 The application attribute with name test1 matches the string "blah". The application attribute with name test1 does not match the string "blah". 示例说明 判断application中属性test1的值是否为blah。 标签名 existsAttribute Tag Body JSP 作用 判断application中是否存在指定名称的属性。 使用示例 The application attribute with name test1 exists. The application attribute with name test1 does not exist. 示例说明 判断application中是否有名为test1的属性。 标签名 removeAttribute Tag Body empty 作用 从application中删除指定名称的属性。 使用示例 示例说明 删除application中名为test1的属性。 标签名 setAttribute Tag Body JSP 作用 设定application中指定属性的值。 使用示例 Test Value 示例说明 设定application中test1的属性值为Test Value。 1.2.2 Application初始化参数标签 标签名 initParameter Tag Body empty 作用 得到application中指定参数的值。 使用示例 示例说明 得到application中参数test1的值。 标签名 initParameters Tag Body JSP 作用 遍历application中所有初始化参数或得到特定参数的值。 使用示例 Name: Value: 示例说明 输出application中所有初始化参数的名称和值。 使用示例 Name: Value: 示例说明 得到application中参数test1的值。 标签名 equalsInitParameter Tag Body JSP 作用 判断application中某参数的值是否与指定值相同。 使用示例 The initialization parameter with name test1 matches "blah". The initialization parameter with name test1 does not match "blah". 示例说明 判断application中参数test1的值是否为blah。 标签名 existsInitParameter Tag Body JSP 作用 判断application中是否存在指定名称的参数。 使用示例 The initializaion parameter with name test1 exists. The initialization parameter with name test1 does not exist. 示例说明 判断application中是否存在参数test1。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值