本文共 1331 字,大约阅读时间需要 4 分钟。
07620170913--- jstl标签库的使用 ---1、将相关jar包导入工程下2、进行标签声明:<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>3、常见标签用法:1)、写法1[注:迭代对象集合]: ${car.id} 写法2[注:重复一定次数]: ${num} 2)、 //... //... 3)、 //... 4)、 :不会对html标记进行解析。[${param.xx}:会自解析]5)、 6)、日期的格式化输出:<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> 4、varStatus属性可以方便实现一些与行数相关的功能,常用属性参数总结如下:1)、${status.index} 输出行号,从0开始。2)、${status.count} 输出行号,从1开始。3)、${status.current} 当前这次迭代的(集合中的)项4)、${status.first} 判断当前项是否为集合中的第一项,返回值为true或false5)、${status.last} 判断当前项是否为集合中的最后一项,返回值为true或false<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> --- display --- ---车列表--- 编号 车型 颜色 评价 List ${cars.number} ${cars.type} ${cars.color} ${cars.comment} Map ${cars.value.number} ${cars.value.type} ${cars.value.color} ${cars.value.comment} Set ${cars.number} ${cars.type} ${cars.color} ${cars.comment}
转载地址:http://sjeof.baihongyu.com/