<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
import="java.util.*"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${path}/a00_util/com.css"/>
</style>
<style>
</style>
<script src="${path}/a00_util/jquery-1.11.2.min.js">
</script>
<script>
$(document).ready(function(){
//alert("jquery시작!!");
});
</script>
</head>
<%
String name[]={"사과","바나나","딸기"};
request.setAttribute("fruits", name);
String grade = request.getParameter("grade");
if(grade!=null){
int intGrade = Integer.parseInt(grade);
request.setAttribute("grade", intGrade);
}
%>
<body><center>
<!--
forEach
for(int cnt=0; cnt<=10; cnt++){
println(cnt);
}
1) begin: 초기값 설정
2) end: 마지막값
3) step: 중기값
-->
<!-- 확인예제
구구단의 값을 받아서 jstl과 el을 이용하여 list하세요
구구단 확인
단 [ ] [조회]
2*1=2
2*2=4
2*3=6
-->
<c:forEach var="cnt" begin="0" end="10" step="1">
<h4>${cnt }</h4>
</c:forEach>
<form method="post">
<table>
<tr>
<td>단 <input type="text" name="grade"/><input type="submit" value="조회"/></td>
</tr>
<c:forEach var="cnt" begin="1" end="9" step="1">
<tr>
<td>${grade } * ${cnt } = ${grade*cnt }</td>
</tr>
</c:forEach>
</table>
</form>
</body>
</html>
'IT > JSTL' 카테고리의 다른 글
JSTL IF ~ ELSE 문 - <c:if>와 <c:choose> (0) | 2015.07.24 |
---|