一:web总结
1.jsp页面知识点巩固
1.1字符串数字格式化转换
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
整数带千分符显示:
<fmt:formatNumber value="${num}" type="number"/>
整数显示:
<fmt:formatNumber value="${num}" pattern="#" type="number"/>
两位小数舍入显示:
<fmt:formatNumber value="${num}" pattern="#.##" type="number"/>
两位小数舍入,不足两位小数补0显示:
<fmt:formatNumber value="${num}" pattern="0.00" type="number"/>
货币显示:(与number类似扩展pattern)
<fmt:formatNumber value="${num}" type="currency"/>
百分数显示:(与number类似扩展pattern)
<fmt:formatNumber value="${num}" type="percent"/>
1.2 jstl标签库与EL标签库
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
//数据回显
<select name="Longflag" class="combox">
<option value="0" ${0 eq been.longflag ? 'selected="selected"' : ''}>临时</option>
<option value="1" ${1 eq been.longflag ? 'selected="selected"' : ''}>长期</option>
</select>
<select name="Longflag" class="combox">
<option value="0" <c:if test="${0 eq been.longflag}">selected</c:if> >临时</option>
<option value="1" <c:if test="${1 eq been.longflag}">selected</c:if> >长期</option>
</select>
//条件标签
<c:if test='${flag == 1}'></c:if> //错误写法 test='${} ' 后有空格
<c:choose>
<c:when test='p1.test_type.equals(p.test_type) and p1.test_item.equals(p.test_item)'></c:when>
<c:when test=''></c:when>
<c:otherwise></c:otherwise>
</c:choose>
//循环标签
<c:foreach item='${performanceList}' var='performance'></c:foreach>