会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
huaobin
博客园
首页
新随笔
联系
订阅
管理
JSTI
<%--
Created by IntelliJ IDEA.
User: jerry
Date:
2019/
12/
12
Time:
4:
12 下午
To change
this template use File | Settings | File Templates.
--%>
<%@ page contentType=
"text/html;charset=UTF-8" language=
"java" %>
<%
@taglib prefix=
"c" uri=
"http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--输出
1-
10之间的偶数
st表示循环状态 可获取当前循环的索引等信息
var 表示每次遍历的临时变量
--%>
<c:forEach begin=
"1" end=
"10" varStatus=
"st"
var=
"num">
<c:
if test=
"${st.index % 2 ==0}">
<h1>${num}是偶数啊</h1>
</c:
if>
</c:forEach>
<%--重定向--%>
<%--<c:redirect url=
"404.html"></c:redirect>--%>
<%--输出--%>
<c:out value=
"hello world"></c:out>
<%--添加属性到某个scope--%>
<c:set scope=
"request"
var=
"number" value=
"a"></c:set>
<%--选择结构--%>
<c:choose >
<c:when test=
"${number=='as'}">
<c:out value=
"你选择a了"/>
</c:when>
<c:when test=
"${number=='b'}">
<c:out value=
"你选择b了"/>
</c:when>
<c:otherwise>
<c:out value=
"不是a和b"/>
</c:otherwise>
</c:choose>
</body>
</html>
posted @
2020-11-29 09:43
青竹之下
阅读(
242
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告