求:request 域中有一个存有 user 对象的 ist 集合。需要使用 jstltel 将 list 集合故据展示到 jsp 页面的表格 table表格中
List list = new ArrayList (); list . add ( ncw User ( name :"张三", age :23, ncw Date ())); list . add ( new User ("李四",24, new Date ())); list . add ( ncw User ("王五",25, ncw Date ())); request . setAttribute ( "1ist", list ); %> <table border ="1" width ="500" lign =" center "> く tr > < th >编号</ th > < th >姓名</ th > < th >年龄</ th > < th >生日</ th > </ tr > <%﹣数据行﹣-%> <: forEach items ="${1ist}” var =" user " varStatus =" s "> く tr > < td >${ s . count }</ td >< td >${ user . name }</ td >< td >${ user . age }</ td >< td >${ user . birSt 巾</ td > く/ tr >
く c : forEach itcms ="${list }" var =" uscr " < c : if test ="${ s . count %2==0}"> く tr > < td >${ s . count }</ td > く td >${ user . name }</ td > < td >${ user . age }</ td > < td >${ user . birStr }</ td ></ tr > </ c : if > < c : if test ="${ s . count %20}"> く tr > < td >${ s . count }</ td > < td >${ user . name }</ td > < td >${ user . ae }</ td > く td >${ user . birStr }</ td > </ tr ></ c : if >