- List item
引用jstl时,在首页加入一句
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core” %>
if 标签
<c:if test = “
u
s
e
r
i
d
=
=
1
"
>
<
/
c
:
i
f
>
s
e
t
标
签
在
p
a
g
e
C
o
n
t
e
x
t
里
添
加
变
量
<
c
:
s
e
t
n
a
m
e
=
"
l
i
"
v
a
l
u
e
=
"
123
"
>
r
e
m
o
v
e
标
签
删
除
s
c
o
p
e
作
用
域
中
的
值
<
c
;
r
e
m
o
v
e
n
a
m
e
=
"
l
i
"
s
c
o
p
e
=
"
p
a
g
e
"
>
c
h
o
o
s
e
w
h
e
n
标
签
类
似
i
f
e
l
s
e
的
用
法
<
c
:
c
h
o
o
s
e
>
<
c
:
w
h
e
n
t
e
s
t
=
"
t
r
u
e
"
>
1
<
/
c
:
w
h
e
n
>
<
c
:
w
h
e
n
t
e
s
t
=
"
f
a
l
s
e
"
>
2
<
/
c
:
w
h
e
n
>
<
c
:
o
t
h
e
r
w
i
s
e
>
3
<
/
c
:
o
t
h
e
r
w
i
s
e
>
<
/
c
:
c
h
o
o
s
e
>
f
o
r
E
a
c
h
标
签
1.
对
l
i
s
t
进
行
遍
历
<
c
:
f
o
r
E
a
c
h
v
a
r
=
"
i
t
e
m
"
i
t
e
m
s
=
"
{userid == 1}"> </c :if> set 标签在pageContext里添加变量 <c:set name ="li" value = "123"> remove 标签 删除scope作用域中的值 <c;remove name = "li" scope = "page"> choose when标签 类似if else 的用法 <c:choose> <c:when test="true" >1</c:when> <c:when test="false">2</c:when> <c:otherwise>3</c:otherwise> </c:choose> forEach 标签 1.对list进行遍历 <c:forEach var ="item" items = "
userid==1"></c:if>set标签在pageContext里添加变量<c:setname="li"value="123">remove标签删除scope作用域中的值<c;removename="li"scope="page">choosewhen标签类似ifelse的用法<c:choose><c:whentest="true">1</c:when><c:whentest="false">2</c:when><c:otherwise>3</c:otherwise></c:choose>forEach标签1.对list进行遍历<c:forEachvar="item"items="{publicList}”>
</c:forEach>
2.对map进行遍历
<c:forEach var = “item” items = “publicMap”>
${item.value}
</c:forEach>