foreach循环遍历表格,一行2个
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href="<%=basePath%>"><title>ShowInverterList</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><link rel="stylesheet" href="css/stationList.css" type="text/css" /><script type="text/javascript">function detailStation(stationId) {location.href="<%=basePath%>UserAction_0004!doQueryStations?stationId="+ stationId;}</script></head><body><center><table><c:forEach begin="0" step="2" varStatus="i" var="station"items="${stations }"><tr><td><div border="0" /><fontstyle="font-family: Arial;color:#68B8FF;"><b>StationName:</b> </font><font style="font-family:Arial;color:#666666;"> <c:outvalue="${station.stationName }"></c:out> </font><br /> <fontstyle="font-family: Arial;color:#68B8FF;"><b>OnlineTime:</b> </font><font style="font-family:Arial;color:#666666;"> <fmt:formatDatevalue="${station.onlineTime }" pattern="yyyy-MM-dd" /> </font><br /><font style="font-family: Arial;color:#68B8FF;"><b>SystemPower(kWp):</b> </font><font style="font-family:Arial;color:#666666;"> <c:outvalue="${station.ratedPower }"></c:out> </font> <br /> <inputstyle="background-image: url('images/btn.png');width: 37px;height: 28px;border: 0px;cursor: pointer;"type="button" onclick="detailStation('${station.stationId}')" /></p></div></td><c:if test="${i.index<fn:length(stations)-1}"><td><div border="0" /><fontstyle="font-family: Arial;color:#68B8FF;"><b>StationName:</b> </font><font style="font-family:Arial;color:#666666;"> <c:outvalue="${stations[i.count*2-1].stationName }"></c:out> </font><br /><font style="font-family: Arial;color:#68B8FF;"><b>OnlineTime:</b> </font><font style="font-family:Arial;color:#666666;"> <fmt:formatDatevalue="${stations[i.count*2-1].onlineTime }"pattern="yyyy-MM-dd" /> </font><br /> <fontstyle="font-family: Arial;color:#68B8FF;"><b>SystemPower(kWp):</b> </font><font style="font-family:Arial;color:#666666;"> <c:outvalue="${stations[i.count*2-1].ratedPower }"></c:out> </font> <br /> <inputstyle="background-image: url('images/btn.png');width: 37px;height: 28px;border: 0px;cursor: pointer;"type="button"onclick="detailStation('${stations[i.count*2-1].stationId}')" /></p></div></td></c:if></tr></c:forEach></table></center></body></html>?<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
?获得集合或者数组长度:fn:length(stations)