2. choose :相当于 java 代码的 switch 语句
1.使用 choose 标签声明 相当于switch
2.使用 when 标签做判断 相当于case
3,使用 otherwise 标签做其他情况的声明 相当于default
request . setAttribute ( " number ", 51);
< C : choose >
< c : when test ="${ number ==1}">星期一</ c : when >
< c : when test ="${ number =2}">星期二</ c : when >
< c : when test ="${ number ==3}">星期三</ c : when >
< c : when test ="${ number ==4}">星期四</ c : when >
< c : when test ="${ number =5}">星期五</ c : when >
< c : when test ="${ number =6}">星期六</ c : when >
< c : when test ="${ number ==7}">星期天</ c : when >
< c : otherwise >数字输入有误</ c : otherwise >
</ c : choose >
foreach相当于JAVA代码中的for循环
< c : forEach begin ="1" end ="10" var =" i " step ="2" varStatus =" s "> ${ i }<h3>${ s . index }<h3><h4>${ s . count }</h4>< br > </ c : forEach > < hr > List list = new ArrayList (); list . add (" aaa "); list . add (" bbb "); list . add (" ccc "); request . setAttribute ( "1ist", list ); %> < c : forEach items ="${ list }” ar =" str " varStatus =" s "> ${ s . index }${ s . count }${ str }< br > </ c : forEach >