application.jsp
来自「jakarta-taglibs」· JSP 代码 · 共 81 行
JSP
81 行
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Jakarta APPLICATION Taglib Example</title>
</head>
<body bgcolor="white">
<center>
<h1>
Jakarta APPLICATION Taglib Example</h1></center>
<br>
<%@ taglib uri="http://jakarta.apache.org/taglibs/application-1.0" prefix="app" %>
<p>
<pre>
See if initialization parameter named "foo" exists
<app:existsInitParameter name="foo">
foo=<app:initParameter name="foo"/>
</app:existsInitParameter>
<app:existsInitParameter name="foo" value="false">
Init parameter foo does not exist.
</app:existsInitParameter>
See if initialization parameter "foo" equals "bar"
<app:equalsInitParameter name="foo" match="bar">
foo=<app:initParameter name="foo"/>
</app:equalsInitParameter>
<app:equalsInitParameter name="foo" match="bar" value="false">
Init parameter foo does does not equal "bar".
</app:equalsInitParameter>
Now loop through all initialization parameters
<app:initParameters id="inits">
<jsp:getProperty name="inits" property="name"/> = <jsp:getProperty name="inits" property="value"/>
</app:initParameters>
Now loop through just the foo init parameter
<app:initParameters id="inits" name="foo">
<jsp:getProperty name="inits" property="name"/> = <jsp:getProperty name="inits" property="value"/>
</app:initParameters>
Set an attribute named "myatt"
<app:setAttribute name="myatt">AAbb</app:setAttribute>
See if myatt attribute exists
<app:existsAttribute name="myatt">
myatt=<app:attribute name="myatt"/>
</app:existsAttribute>
<app:existsAttribute name="myatt" value="false">
Attribute myatt does not exist.
</app:existsAttribute>
See if myatt equals "aabb"
<app:equalsAttribute name="myatt" match="aabb">
myatt=<app:attribute name="myatt"/>
</app:equalsAttribute>
<app:equalsAttribute name="myatt" match="aabb" value="false">
Attribute myatt does not equal "aabb".
</app:equalsAttribute>
See if myatt equals "aabb", ignoring case
<app:equalsAttribute name="myatt" match="aabb" ignoreCase="true">
myatt=<app:attribute name="myatt"/>
</app:equalsAttribute>
<app:equalsAttribute name="myatt" match="aabb" value="false" ignoreCase="true">
Attribute myatt does not equal "aabb", ignoring case.
</app:equalsAttribute>
Now loop through all the attributes
<app:attributes id="att">
<jsp:getProperty name="att" property="name"/> = <jsp:getProperty name="att" property="value"/>
</app:attributes>
Now loop through just the myatt attribute
<app:attributes id="att" name="myatt">
<jsp:getProperty name="att" property="name"/> = <jsp:getProperty name="att" property="value"/>
</app:attributes>
Now remove the attribute myatt
<app:removeAttribute name="myatt"/>
See if myatt attribute exists
<app:existsAttribute name="myatt">
myatt=<app:attribute name="myatt"/>
</app:existsAttribute>
<app:existsAttribute name="myatt" value="false">
Attribute myatt does not exist.
</app:existsAttribute>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?