zoukankan      html  css  js  c++  java
  • JSTI

    <%--
      Created by IntelliJ IDEA.
      User: jerry
      Date: 2019/12/12
      Time: 4:12 下午
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

    <html>
    <head>
        <title>Title</title>
    </head>
    <body>

    <%--输出1-10之间的偶数
    st表示循环状态 可获取当前循环的索引等信息
    var 表示每次遍历的临时变量
    --%>
    <c:forEach begin="1" end="10" varStatus="st" var="num">
        <c:if test="${st.index % 2 ==0}">
            <h1>${num}是偶数啊</h1>
        </c:if>
    </c:forEach>

    <%--重定向--%>
    <%--<c:redirect url="404.html"></c:redirect>--%>

    <%--输出--%>
    <c:out value="hello world"></c:out>

    <%--添加属性到某个scope--%>
    <c:set scope="request" var="number" value="a"></c:set>

    <%--选择结构--%>
    <c:choose >
        <c:when test="${number=='as'}">
            <c:out value="你选择a了"/>
        </c:when>
        <c:when test="${number=='b'}">
            <c:out value="你选择b了"/>
        </c:when>
        <c:otherwise>
            <c:out value="不是a和b"/>
        </c:otherwise>
    </c:choose>

    </body>
    </html>
     
  • 相关阅读:
    php数组
    php运算符
    PHP数据类型
    面向对象3和继承
    面向对象2
    面向对象1
    语法整理php
    语法整理
    ajax
    数据库4
  • 原文地址:https://www.cnblogs.com/huaobin/p/14162638.html
Copyright © 2011-2022 走看看