ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 211111_jstl_연산자
    카테고리 없음 2021. 11. 11. 11:25

    <%@ page language="java" contentType="text/html; charset=UTF-8"

        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>

    <html>

    <head>

    <meta charset="UTF-8">

    <link href="https://fonts.googleapis.com/css2?family=Do+Hyeon&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

    <script src="https://code.jquery.com/jquery-3.5.0.js"></script>

    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

    <title>Insert title here</title>

    </head>

    <body>

    <h2>JSTL 연산자 연습</h2>

    <!-- jstl 변수선언 -->

    <c:set var="su1" value="7"/>

    <c:set var="su2" value="5"/>

     

    <b>두 변수값 출력(su1:${su1},su2:${su2})</b>

     

    <table class="table table-bordered" style="width: 400px;">

      <tr>

        <th width="250">\${su1+su2}</th>

        <td>${su1+su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1-su2}</th>

        <td>${su1-su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1*su2}</th>

        <td>${su1*su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1/su2}</th>

        <td>${su1/su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1 div su2}</th>

        <td>${su1 div su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1%su2}</th>

        <td>${su1%su2}</td>

      </tr>

      

      <tr>

        <th width="250">\${su1 mod su2}</th>

        <td>${su1 mod su2}</td>

      </tr>

      

    <!-- 증감식 -->  

      <tr>

        <th>su1 1증가</th>

          <td>

            증가전 su1:<c:out value="${su1}"/><br>

            <c:set var="su1" value="${su1+1}"/>

            증가후 su1:${su1}

          </td>

      </tr>

    </table>

    </body>

    </html>

     

    댓글

Designed by Tistory.