c标签用法

来源:互联网 发布:java安防软件 编辑:程序博客网 时间:2024/05/18 03:42
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>显示图片</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" type="text/css" href="styles.css">
-->


  </head>
  
  <body>
    <c:choose>
    <c:when test="${empty photosPaths}">
    <h1 style="color: purple;font-size: 50px;">暂时还没有图片</h1>
    </c:when>
    <c:otherwise>
    <c:forEach var="path" items="${photosPaths}" begin="0" end="${size-1}" step="1" varStatus="status">
    <%-- <img src="/8JSP${path }" height="200px" width="200px"/> --%>
    <c:choose>
    <c:when test="${status.first}">
    <a href="http://www.baidu.com"><img src="${path }" height="200px" width="200px"/></a>
    </c:when>
    <c:when test="${status.last}">
    <a href="http://www.google.com"><img src="${path }" height="200px" width="200px"/></a>
    </c:when>
    <c:when test="${status.count == 10}">
    <a href="http://www.qq.com"><img src="${path }" height="200px" width="200px"/></a>
    </c:when>
    <c:when test="${status.count == 21}">
    <a href="http://www.kouyang.com"><img src="${path }" height="200px" width="200px"/></a>
    </c:when>
    <c:otherwise>
    <img src="${path }" height="200px" width="200px"/>
    </c:otherwise>
    </c:choose>
    <%-- <img src="${path }" height="200px" width="200px"/>
    ---${status.index }---${status.count }---${status.first }---${status.last }<br> --%>
    <c:if test="${status.count % 5 == 0 && (status.index+1) % 5 == 0}">
    <br>
    </c:if>
    </c:forEach>
    </c:otherwise>
    </c:choose>
  </body>
</html>
原创粉丝点击