Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
beginnersbook-zh
提交
5142ebd6
B
beginnersbook-zh
项目概览
OpenDocCN
/
beginnersbook-zh
9 个月 前同步成功
通知
0
Star
107
Fork
30
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beginnersbook-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5142ebd6
编写于
10月 15, 2019
作者:
W
wizardforcel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
2019-10-15 11:13:54
上级
9d0dad03
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
75 addition
and
75 deletion
+75
-75
docs/jstl/10.md
docs/jstl/10.md
+2
-2
docs/jstl/11.md
docs/jstl/11.md
+3
-3
docs/jstl/12.md
docs/jstl/12.md
+4
-4
docs/jstl/14.md
docs/jstl/14.md
+4
-4
docs/jstl/15.md
docs/jstl/15.md
+11
-11
docs/jstl/16.md
docs/jstl/16.md
+2
-2
docs/jstl/18.md
docs/jstl/18.md
+2
-2
docs/jstl/19.md
docs/jstl/19.md
+2
-2
docs/jstl/20.md
docs/jstl/20.md
+2
-2
docs/jstl/21.md
docs/jstl/21.md
+2
-2
docs/jstl/22.md
docs/jstl/22.md
+4
-4
docs/jstl/23.md
docs/jstl/23.md
+2
-2
docs/jstl/24.md
docs/jstl/24.md
+4
-4
docs/jstl/25.md
docs/jstl/25.md
+2
-2
docs/jstl/27.md
docs/jstl/27.md
+6
-6
docs/jstl/3.md
docs/jstl/3.md
+4
-4
docs/jstl/30.md
docs/jstl/30.md
+2
-2
docs/jstl/31.md
docs/jstl/31.md
+2
-2
docs/jstl/32.md
docs/jstl/32.md
+2
-2
docs/jstl/4.md
docs/jstl/4.md
+4
-4
docs/jstl/5.md
docs/jstl/5.md
+4
-4
docs/jstl/6.md
docs/jstl/6.md
+3
-3
docs/jstl/7.md
docs/jstl/7.md
+2
-2
未找到文件。
docs/jstl/10.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法:
```
```
html
<c:catch
var =
"variable_name"
>
//Set of statements in which exception can occur
</c:catch>
...
...
@@ -20,7 +20,7 @@
**注**
:如果
`<c:catch>`
中的语句块中没有异常那么变量(例如它的
`errormsg`
)应该具有空值。这就是我们在打印变量值之前检查
`errormsg != null`
的原因。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
docs/jstl/11.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@ JSTL`<c:import>`标签用于将内容从另一个文件/页面导入到当前的
#### 语法:
```
```
html
<c:import
var=
"variable_name"
url=
"relative_url"
/>
```
...
...
@@ -24,7 +24,7 @@ JSTL`<c:import>`标签用于将内容从另一个文件/页面导入到当前的
`display.jsp`
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<c:out
value=
"Chaitanya"
/>
<c:out
value=
"BeginnersBook.com"
/>
...
...
@@ -35,7 +35,7 @@ JSTL`<c:import>`标签用于将内容从另一个文件/页面导入到当前的
这里我们将
`display.jsp`
中的数据导入变量
`mydata`
,然后我们使用
[
`<c:out>`标签
](
https://beginnersbook.com/2013/11/jstl-cout-core-tag/
)
在浏览器上显示它。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
docs/jstl/12.md
浏览文件 @
5142ebd6
...
...
@@ -10,7 +10,7 @@ JSTL 中的`<c:forEach>`标签用于执行有限次数的同一组语句。它
#### `<c:forEach>`的语法
```
```
html
<c:forEach
var=
"counter_variable_name"
begin=
"intial_value"
end=
"final_limit"
>
//Block of statements
</c:forEach>
...
...
@@ -26,7 +26,7 @@ JSTL 中的`<c:forEach>`标签用于执行有限次数的同一组语句。它
在这个例子中,我们使用
`<c:forEach>`
在循环中打印变量计数器的值。标签。循环从值 1 开始(在
`begin`
属性中提到)并且在值 10(
`end`
属性的值)处结束。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -48,7 +48,7 @@ JSTL 中的`<c:forEach>`标签用于执行有限次数的同一组语句。它
#### `<c:forTokens>`语法
```
```
html
<c:forTokens
items=
"value(s)"
delims=
"delimiter"
var=
"variable_name"
>
//Set of statements
</c:forTokens>
...
...
@@ -64,7 +64,7 @@ JSTL 中的`<c:forEach>`标签用于执行有限次数的同一组语句。它
在这个例子中,我们使用分隔符点(
`'.'`
)将字符串拆分为多个子字符串。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
docs/jstl/14.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法:
```
```
html
<c:param
name=
"parameter_name"
value=
"parameter_value"
/>
```
...
...
@@ -19,7 +19,7 @@
在这个例子中,我们使用
`<c:param>`
标签用于将参数添加到结果 URL。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -43,7 +43,7 @@ ${completeURL}
这里我们使用
`<c:param>`
标签传递参数以及重定向网址,然后我们使用表达式语言的
[
`param`变量
](
https://beginnersbook.com/2013/11/jsp-expression-language-el/
)
在重定向页面上显示这些参数。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -61,7 +61,7 @@ ${completeURL}
`display.jsp`
```
```
html
USER ID IS: ${param.UserId}
USER NAME IS: ${param.UserName}
```
...
...
docs/jstl/15.md
浏览文件 @
5142ebd6
...
...
@@ -8,7 +8,7 @@
基本语法如下所示 - 属性
`value`
是
`<c:url>`
标签的必需属性。
```
```
html
<c:url
value=
"/file1.jsp"
/>
```
...
...
@@ -22,7 +22,7 @@
#### 示例 1:`<c:url>`的值属性
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -36,7 +36,7 @@
**输出**
:上面的代码输出如下。
**注意:**
`BeginnersBook`
是我的项目名称(换句话说是 JSP 应用名称)。
```
```
html
/BeginnersBook/file1.jsp
```
...
...
@@ -46,14 +46,14 @@
让我们像这样修改示例 1。我们在
`<c:url>`
中添加了一个变量
`myurl`
。现在
`<c:url>`
的结果将存储在变量
`myurl`
中。
```
```
html
<c:url
var=
"myurl"
value=
"/file1.jsp"
/>
${myurl}
```
输出:
```
```
html
/BeginnersBook/file1.jsp
```
...
...
@@ -63,18 +63,18 @@ ${myurl}
**注意**
:上下文的值应始终以
`/`
开头,否则您将收到以下异常消息:
```
```
html
HTTP 状态 500 - javax.servlet.ServletException:javax.servlet.jsp.JspTagException:在 URL 标签中,当指定“context”属性时,“context”和“url”的值必须以“/”开头。
```
```
```
html
<c:url
var=
"myurl"
value=
"/file1.jsp"
context=
"/MyJSPProject"
/>
${myurl}
```
输出:
```
```
html
/MyJSPProject/file1.jsp
```
...
...
@@ -82,7 +82,7 @@ ${myurl}
#### 示例 4:`scope`属性
```
```
html
<c:url
var=
"myurl"
value=
"/file1.jsp"
context=
"/MyJSPProject"
scope=
"session"
/>
${requestScope.myurl}
```
...
...
@@ -91,13 +91,13 @@ ${requestScope.myurl}
**正确用法:**
这是应该编码的方式。这里我们存储在会话中并从
[
`sessionScope`
](
https://beginnersbook.com/2013/11/jsp-expression-language-el/
)
中获取,因此它可以正常工作。
```
```
html
<c:url
var=
"myurl"
value=
"/file1.jsp"
context=
"/MyJSPProject"
scope=
"session"
/>
${sessionScope.myurl}
```
输出:
```
```
html
/MyJSPProject/file1.jsp
```
\ No newline at end of file
docs/jstl/16.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法:
```
```
html
<c:redirect
url=
"http://www.anydomainhere.com/samplepage.jsp"
/>
```
...
...
@@ -16,7 +16,7 @@
在这里,我们根据变量
`myurl`
的值将页面重定向到不同的 URL。如果值为 1,则页面将重定向到
`http://beginnersbook.com`
,对于 2,它将转到
`http://www.google.com`
。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
docs/jstl/18.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法:
```
```
html
boolean fn:contains(String inputstring, String checkstring)
```
...
...
@@ -16,7 +16,7 @@ boolean fn:contains(String inputstring, String checkstring)
在此示例中,我们检查新密码是否包含旧密码作为子字符串,如果是,则我们向用户显示消息。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/19.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法:
```
```
html
boolean fn:containsIgnoreCase(String input, String checkstring)
```
...
...
@@ -16,7 +16,7 @@ boolean fn:containsIgnoreCase(String input, String checkstring)
在这个例子中,我们有两个字符串 - ·
`string1`
和
`string2`
。我们正在检查
`string1`
中是否存在
`string2`
。如果结果为
`true`
,那么我们正在显示一条消息。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/20.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
int indexOf(String, String )
```
...
...
@@ -22,7 +22,7 @@ int indexOf(String, String )
在这个例子中,我们找到几个字符串的索引并使用
[
EL
](
https://beginnersbook.com/2013/11/jsp-expression-language-el/
)
显示它们。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/21.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
String escapeXml(String input_string)
```
...
...
@@ -19,7 +19,7 @@ String escapeXml(String input_string)
这里我们有两个字符串,其 html 标签为粗体(
`<b>`
)和斜体(
`<i>`
)。我们正在使用
`fn:escapeXml()`
函数处理它们。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/22.md
浏览文件 @
5142ebd6
...
...
@@ -10,7 +10,7 @@
#### 语法
```
```
html
String fn:join(String arrayofstrings, String separator)
```
...
...
@@ -20,7 +20,7 @@ String fn:join(String arrayofstrings, String separator)
在这个例子中,我们有一个字符串数组,我们使用分隔符(
`'&'`
)连接它们。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
@@ -49,7 +49,7 @@ ${fn:join(names, " & ")}
#### 语法
```
```
html
String[] fn:split(String inputstring, String delimiterstring)
```
...
...
@@ -57,7 +57,7 @@ String[] fn:split(String inputstring, String delimiterstring)
在这个例子中,我们有一个输入字符串,其间的空格字符很少。我们使用
`fn:split()`
函数将空格分隔为分隔符。该函数返回子字符串的数组。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/23.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@ JSTL 函数 `fn:length()`用于计算字符串的长度或查找集合中元素
#### 语法
```
```
html
int length(Object)
```
...
...
@@ -16,7 +16,7 @@ int length(Object)
这里我们使用函数计算三个不同字符串的长度。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/24.md
浏览文件 @
5142ebd6
...
...
@@ -10,7 +10,7 @@
**语法:**
```
```
html
String fn:trim(String input)
```
...
...
@@ -20,7 +20,7 @@ String fn:trim(String input)
在这个例子中,我们有一个字符串,它在字符串
`"mymsg"`
的开头和结尾附加了很少的空格字符,我们正在使用该函数截断这些空格。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
@@ -44,7 +44,7 @@ ${fn:trim(mymsg)}
**语法:**
```
```
html
boolean fn:startsWith(String input, String prefix)
```
...
...
@@ -54,7 +54,7 @@ boolean fn:startsWith(String input, String prefix)
这里我们有一个长字符串和两个子字符串,我们正在检查字符串是否以任何子字符串开头。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/25.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
boolean fn:endsWith(input_string, suffix_string)
```
...
...
@@ -18,7 +18,7 @@ boolean fn:endsWith(input_string, suffix_string)
在示例中,我们有一个输入字符串
`"BeginnersBook.com"`
和另外 4 个字符串。我们正在验证输入字符串是否以给定的四个字符串结束。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/27.md
浏览文件 @
5142ebd6
...
...
@@ -10,7 +10,7 @@
#### 语法
```
```
html
String fn:substring(String inputstring, int start, int end)
```
...
...
@@ -23,7 +23,7 @@ String fn:substring(String inputstring, int start, int end)
在这个例子中,我们通过提供子字符串的起始和结束位置从给定字符串中获取子字符串。
```
```
html
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
...
...
@@ -47,7 +47,7 @@ ${fn:substring(msg, 10, 26)}
#### 语法
```
```
html
String fn:substringAfter(String input, String afterstring)
```
...
...
@@ -55,7 +55,7 @@ String fn:substringAfter(String input, String afterstring)
#### `fn:substringAfter()`的示例
```
```
html
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
...
...
@@ -79,7 +79,7 @@ ${fn:substringAfter(name, "Pr")}
#### 语法
```
```
html
String fn:substringBefore(String input, String beforestring)
```
...
...
@@ -87,7 +87,7 @@ String fn:substringBefore(String input, String beforestring)
#### `fn:substringBefore()`的示例
```
```
html
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
...
...
docs/jstl/3.md
浏览文件 @
5142ebd6
...
...
@@ -8,7 +8,7 @@
在这个例子中,我们在浏览器上显示一个字符串,但是我们在值中使用了 html 标签,我们希望看到结果是什么以及它是如何使用 HTML 标签的。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -22,7 +22,7 @@
输出:
```
```
html
`
<b>
这是
<c:out>
示例
</b>
```
...
...
@@ -32,7 +32,7 @@
假设我像这样修改上面的代码 - 我刚刚在标签中添加了
`escapeXML`
属性并将其标签为
`false`
。
**默认情况下,`escapeXML`属性的值为`true`**
。由于我们将其标签为
`false`
,因此它不会转义 HTML / XML 标签,并且标签将起作用。
```
```
html
<c:out
value=
"${'<b>This is a <c:out> example </b>'}"
escapeXml=
"false"
/>
```
...
...
@@ -44,7 +44,7 @@
上面我们看到了
`<c:out>`
的
`escapeXML`
属性。标签。此标签还有另一个属性
`default`
,用于显示
`<c:out>`
的值为
`null`
时的后备或默认值。下面是我们尝试使用标签打印字符串
`str`
的值的示例,并且由于字符串
`str`
值为
`null`
,标签正在打印
`default`
属性中设置的值。
```
```
html
<
%!
String
str =
null;
%
>
<c:out
value=
"${str}"
default=
"default value of c:out"
/>
```
...
...
docs/jstl/30.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
String fn:toUpperCase(String input)
```
...
...
@@ -16,7 +16,7 @@ String fn:toUpperCase(String input)
在这里,我们使用该函数将少量字符串转换为其大写字母。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/31.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
String fn:toLowerCase(String input)
```
...
...
@@ -16,7 +16,7 @@ String fn:toLowerCase(String input)
在这个例子中,我们将这个函数应用于两个字符串 - 一个是字符串变量,另一个是硬编码字符串,作为函数的参数给出。正如您在输出中看到的那样,它已将变量的值和硬编码的字符串值替换为小写。在此代码之后提供输出的屏幕截图。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/32.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
#### 语法
```
```
html
String fn:replace(String input, String search_for, String replace_with)
```
...
...
@@ -18,7 +18,7 @@ String fn:replace(String input, String search_for, String replace_with)
在这个例子中,我们在两个输入字符串上使用
`fn:replace()`
函数。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%
>
<html>
...
...
docs/jstl/4.md
浏览文件 @
5142ebd6
...
...
@@ -6,7 +6,7 @@
这里我将一个字符串值赋给
[
应用范围
](
https://beginnersbook.com/2013/11/jsp-implicit-object-application-with-examples/
"Application"
)
中的变量
`name`
(它允许我在应用的任何 JSP 页面中访问我的变量)。在另一页(
`display.jsp`
)上,我使用
[
`<c:out>`标签
](
https://beginnersbook.com/2013/11/jstl-cout-core-tag/
"`<c:out>` tag"
)
和
[
EL
](
https://beginnersbook.com/2013/11/jsp-expression-language-el/
)
在浏览器上打印了值。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -21,7 +21,7 @@
`display.jsp`
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<c:out
value=
"${name}"
/>
```
...
...
@@ -38,13 +38,13 @@
变量
`myvar`
的值将存储在对象名称中。
```
```
html
<c:set
var=
"name"
scope=
"application"
value=
"${myvar}"
/>
```
表达式的结果将存储在对象中。
```
```
html
<c:set
var=
"sum"
scope=
"application"
value=
"${1+3+6}"
/>
```
...
...
docs/jstl/5.md
浏览文件 @
5142ebd6
...
...
@@ -8,7 +8,7 @@
在下面的例子中,首先我使用
[
`<c:set>`标签
](
https://beginnersbook.com/2013/11/jstl-cset-core-tag/
"c:set"
)
设置了两个变量,然后我使用
`<c:remove>`
删除了其中一个标签。正如您在输出屏幕截图中看到的那样 - 当我尝试显示两个变量时,对于第二个属性,页面没有获得任何值,并使用
`<c:out>`
标签](https://beginnersbook.com/2013/11/jstl-cout-core-tag/)的
`default`
属性打印默认值。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -25,7 +25,7 @@
`display.jsp`
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<c:out
value=
"${Site}"
/><br>
<c:out
value=
"${author}"
default=
"Attribute has no value"
/>
...
...
@@ -39,12 +39,12 @@
上面我们编码像这样
```
```
html
<c:remove
var=
"author"
/>
```
上面的代码从所有范围(页面,会话,应用,请求)中删除了一个属性。为了具体起见,我们必须在
`<c:remove>`
中指定
`scope`
属性,就像我在下面所做的那样 - 下面的 JSTL 语句将从
[
会话范围
](
https://beginnersbook.com/2013/11/jsp-implicit-object-session-with-examples/
)
中删除变量
`var`
。
```
```
html
<c:remove
var=
"author"
scope=
"session"
/>
```
\ No newline at end of file
docs/jstl/6.md
浏览文件 @
5142ebd6
...
...
@@ -8,7 +8,7 @@
这是
`<c:if>`
的基本语法核心标签。包含在
`<c:if>`
范围内的语句集如果为
`"true"`
,则执行标签。为了使用此标签,我们通常使用
[
表达语言
](
https://beginnersbook.com/2013/11/jsp-expression-language-el/
)
来评估关系表达式。我们使用 EL,因为它在评估条件后返回布尔值(
`true`
/
`false`
),我们需要
`test`
属性的布尔值。
```
```
html
<c:if
test=
"${condition}"
>
...
..
...
...
@@ -19,7 +19,7 @@
在该示例中,我们使用
[
`<c:set>`标签
](
https://beginnersbook.com/2013/11/jstl-cset-core-tag/
)
定义了
`age`
变量。然后我们通过使用
`<c:if>`
来检查投票的资格。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
@@ -52,7 +52,7 @@
将测试结果存储在请求范围中的变量
`res`
中。为了打印我们给
`requestScope.res`
的值,因为变量存储在请求中,但是你甚至可以单独给出变量名(
`res`
),它可以正常工作。
```
```
html
<c:if
test=
"${17 >= 18}"
var=
"res"
scope=
"request"
>
</c:if>
<c:out
value=
"${requestScope.res}"
/>
...
...
docs/jstl/7.md
浏览文件 @
5142ebd6
...
...
@@ -8,7 +8,7 @@
基本结构看起来像这样:
```
```
html
<c:choose>
<c:when
test=
"${condition1}"
>
//do something if condition1 is true
...
...
@@ -26,7 +26,7 @@
在这个例子中,我们有三个数字,我们使用这三个核心标签来比较它们。示例非常简单易懂。在示例代码之后提供输出的屏幕截图。
```
```
html
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<html>
<head>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录