• jstl标签


    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
    <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>jstl练习</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>
        This is my JSP page.
        <br>
        <h6>下面是out测试</h6>
        <c:out value="out"></c:out>
        <h6>下面是set测试</h6>
        <%
            request.setAttribute("out", "hello");
        %>
        <c:set var="username" value="test"></c:set>
        <c:out value="${username }" />
        <h6>下面是curl测试</h6>
        <a
            href="<c:url value='index.jsp'>
          <c:param name='username' value='战三'/> </c:url>">index
        </a>
    
        <h6>下面是if测试</h6>
        <c:set var="password" value="12345"></c:set>
        <c:if test="${not empty password}">
            <c:out value="${password}"></c:out>
        </c:if>
    
        <h6>下面是choose测试</h6>
        <c:choose>
            <c:when test="${not empty param.name}">测试空</c:when>
            <c:otherwise>不为空</c:otherwise>
        </c:choose>
        <h6>下面是foreach测试</h6>
        <c:forEach var="i" begin="1" end="10">
            ${i}
        </c:forEach>
        <br />
        <%
            String[] array = { "1", "2" };
            request.setAttribute("array", array);
        %>
    
        <c:forEach items="${array}" var="item">
             ${item}
        </c:forEach>
    
    <h6>下面是fmt测试</h6>
     
    <c:out value="记得加fmt库"/>
    <%
        Date date=new Date();
        request.setAttribute("date", date);
     %>
     当前时间为:
    <fmt:formatDate value="${date}" pattern="yyyy-MM-dd hh:mm:ss"/>
    </body>
    </html>
  • 相关阅读:
    Linux开机启动详解
    git配置多用户多平台
    CentOS7 启动docker.service失败(code=exited, status=1/FAILURE)
    Linux 利用lsof命令恢复删除的文件
    56.storm 之 hello world (集群模式)
    55.storm 之 hello word(本地模式)
    54.Storm环境搭建
    53.storm简介
    深入浅出Mybatis-分页
    storm:最火的流式处理框架
  • 原文地址:https://www.cnblogs.com/lzhp/p/5544590.html
Copyright © 2020-2023  润新知