[Web] - AJAX

sueยท2024๋…„ 2์›” 8์ผ

๐Ÿ“’๊ตญ๋น„ํ•™์› [Web]

๋ชฉ๋ก ๋ณด๊ธฐ
20/21
post-thumbnail

1. ajax ๊ธ€์ž ๋„์šฐ๊ธฐ

โœ๏ธ Test1.

๐Ÿ’ป ์ž…๋ ฅ

์•„์ž‘์Šค

  • โฌ‡๏ธ helloAjax.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<script type="text/javascript">

	var xmlHttp;
	
	function ajaxRequest() {
		
		xmlHttp = new XMLHttpRequest();
		
		xmlHttp.open("get","helloAjax_ok.jsp",true);
		xmlHttp.onreadystatechange = viewMessage;
		xmlHttp.send(null);
		
	}
	
	function viewMessage() {
		
		var responseText = xmlHttp.responseText;
		
		var divE = document.getElementById("printDiv");
		
		divE.innerHTML = responseText;
		
	}

</script>



</head>
<body>


<h1>Hello AJax</h1>
<input type="button" value="ํด๋ฆญ" onclick="ajaxRequest();"/>

<br/><br/>
<div id="printDiv" style="border: 1px solid red; width: 50%"></div>

</body>
</html>

  • โฌ‡๏ธ helloAjax_ok.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>


์–ด๋ ต์ง€๋งŒ ์žฌ๋ฐŒ๋Š” AJax!!!


2. "GET"๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ด๊ธฐ

โœ๏ธ Test2.

๐Ÿ’ป ์ž…๋ ฅ

  • โฌ‡๏ธ ajaxGetPost.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<script type="text/javascript">

	var xmlHttp;
	
	function ajaxRequestGet() {
		
		xmlHttp = new XMLHttpRequest();
		
		var f = document.myForm;
		
		var data = f.greeting.value; //<input type="text" name="greeting"/> -> greeting์„ ๋œปํ•จ
	
		if(data==""){
			alert("๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”!");
			f.greeting.focus();
			return;
		}
		xmlHttp.open("GET", "ajaxGetPost_ok.jsp?greeting="+data,true); //๋น„๋™๊ธฐ๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ผ๊ฑฐ์ž„
		xmlHttp.onreadystatechange = viewMessage; //viewMessage = callback ํ•จ์ˆ˜ -> ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด์•ผํ•จ
		xmlHttp.send(null);
	}

	function viewMessage() {
		
		var divE = document.getElementById("printDiv");
		
		if(xmlHttp.readyState==1||
				xmlHttp.readyState==2||
					xmlHttp.readyState==3){
			
			divE.innerHTML = "<img src='./image/processing.gif' width='50' height='50'/>" //์ง€๊ธˆ ์‹คํ–‰์ค‘์ด์•ผ~๋ผ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์„๊ฑฐ์ž„
			
		}else if(xmlHttp.readyState==4){
			
			divE.innerHTML = xmlHttp.responseText; //๋ฐ›์•„์„œ ๋ฟŒ๋ฆฌ๋ฉด ๋จ
			
		}
		
	}
	

</script>


</head>
<body>

<h1>AJaxGetPost</h1>
<hr/>
<form action="" name="myForm">
	<input type="text" name="greeting"/>
	<input type="button" value="Get ์ „์†ก" onclick="ajaxRequestGet();"/>
</form>

<div id="printDiv" style="border: 1px solid blue; widows: 50%"></div>


</body>
</html>


  • โฌ‡๏ธ ajaxGetPost_ok.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
	
	//๋„˜์–ด์˜ค๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ์œผ๋‹ˆ๊นŒ ๋ฐ›์•„์•ผํ•จ
	String greeting = request.getParameter("greeting");
	
	//์ž„์˜๋กœ ์ฒ˜๋ฆฌ์‹œ๊ฐ„ ๋งŒ๋“ค์–ด์ฃผ๊ธฐ
	for(int i=0;i<35000;i++){
		System.out.print("๊ธฐ๋‹ค๋ ค..์ฒ˜๋ฆฌ์ค‘...");
	}
	
%>

<%="server : " + greeting %>


	for(int i=0;i<35000;i++){
		System.out.print("๊ธฐ๋‹ค๋ ค..์ฒ˜๋ฆฌ์ค‘...");
	}

3. "POST"๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ด๊ธฐ

โœ๏ธ Test3.

๐Ÿ’ป ์ž…๋ ฅ

  • โฌ‡๏ธ ajaxGetPost.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<script type="text/javascript">

	var xmlHttp; //์—ฌ๊ธฐ์— 3๊ฐ€์ง€ ๊ฐ์ฒด๊ฐ€ ๋“ค์–ด๊ฐ€์žˆ์Œ (์•„๋ž˜ if๋ฌธ 3๊ฐœ)
	
	function getXmlHttpRequest() { //๋ˆ„๊ฐ€ ์‹คํ–‰์‹œํ‚ค๋ƒ๋ฉด -> ์Šคํฌ๋ฆฝํŠธ ๋งจ ์•„๋ž˜์ชฝ์— ๋งŽ์ด ์ ์–ด๋‘ 
		
		if(window.ActiveXObject){
			
			//๊ฐ์ฒด ์ƒ์„ฑ ๋ฐฉ๋ฒ•
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				
			} catch (e) {
				
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				
			}
		}else{
			
			xmlHttp = new XMLHttpRequest();
			
		}
	}
	
	function ajaxRequestGet() {

		var f = document.myForm;
		
		var data = f.greeting.value; //<input type="text" name="greeting"/> -> greeting์„ ๋œปํ•จ
	
		if(data==""){
			alert("๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”!");
			f.greeting.focus();
			return;
		}
		xmlHttp.open("GET", "ajaxGetPost_ok.jsp?greeting="+data,true); //๋น„๋™๊ธฐ๋ฐฉ์‹์œผ๋กœ ๋ณด๋‚ผ๊ฑฐ์ž„
		xmlHttp.onreadystatechange = viewMessage; //viewMessage = callback ํ•จ์ˆ˜ -> ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด์•ผํ•จ
		xmlHttp.send(null);
	}

	function ajaxRequestPost() {

		var f = document.myForm;
		
		var data = f.greeting.value; //<input type="text" name="greeting"/> -> greeting์„ ๋œปํ•จ
	
		if(data==""){
			alert("๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”!");
			f.greeting.focus();
			return;
		}
		xmlHttp.open("POST", "ajaxGetPost_ok.jsp",true); //POST๋ฐฉ์‹ -> ๋ฐ์ดํ„ฐ ๊ฐ€์ง€๊ณ ๊ฐˆ ์ˆ˜ ์—†์Œ
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
		xmlHttp.onreadystatechange = viewMessage; 
		xmlHttp.send("greeting="+data);
	}
	
	
	function viewMessage() {
		
		var divE = document.getElementById("printDiv");
		
		if(xmlHttp.readyState==1||
				xmlHttp.readyState==2||
					xmlHttp.readyState==3){
			
			divE.innerHTML = "<img src='./image/processing.gif' width='50' height='50'/>" //์ง€๊ธˆ ์‹คํ–‰์ค‘์ด์•ผ~๋ผ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์„๊ฑฐ์ž„
			
		}else if(xmlHttp.readyState==4){
			
			divE.innerHTML = xmlHttp.responseText; //๋ฐ›์•„์„œ ๋ฟŒ๋ฆฌ๋ฉด ๋จ
			
		}
		
	}
	
	//function getXmlHttpRequest() { // ์–˜๊ฐ€ ์‹คํ–‰์‹œํ‚ด
	window.onload = function () {
		getXmlHttpRequest();
	}
	
	
	
</script>


</head>
<body>

<h1>AJaxGetPost</h1>
<hr/>
<form action="" name="myForm">
	<input type="text" name="greeting"/>
	<input type="button" value="Get ์ „์†ก" onclick="ajaxRequestGet();"/>
	<input type="button" value="Post ์ „์†ก" onclick="ajaxRequestPost();"/>
</form>

<div id="printDiv" style="border: 1px solid blue; widows: 50%"></div>


</body>
</html>


4. ์œ ํšจํ•œ ์•„์ด๋””๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค

โœ๏ธ Test4.

๐Ÿ’ป ์ž…๋ ฅ

  • โฌ‡๏ธ ajaxId.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<script type="text/javascript">

	var xmlHttp = new XMLHttpRequest();
	
	function requestGet() {
		
		var f = document.myForm;
		
		var params = "?userId=" + f.userId.value;
		
		xmlHttp.open("GET", "ajaxId_ok.jsp" + params, true);
		xmlHttp.onreadystatechange = viewMessage;
		xmlHttp.send(null);
	}

	function viewMessage() {
		
		if(xmlHttp.readyState==4){
			
			if(xmlHttp.status=200){
				
				//์œ„ ์กฐ๊ฑด์— ๋งž์„ ๋•Œ ๋ฐ์ดํ„ฐ ๋ฐ›์•„๋‚ด๊ธฐ 
				var str = xmlHttp.responseText;
				
				var divE = document.getElementById("resultDiv");
				
				divE.innerHTML =  str;
				
			}
		}else{
			
			var divE = document.getElementById("resultDiv");
			divE.innerHTML = "<img src='./image/loading.gif' width='15' height='15'/>"
		}
	}
	
</script>


</head>
<body>


<h1>Ajax ID ํ™•์ธ</h1>
<hr/>

<form action="" name="myForm">

์•„์ด๋”” : <input type="text" name="userId" onkeyup="requestGet();"/>
</form>

<div id="resultDiv" style="color: red; border: 1px solid; width: 40%"></div>

</body>
</html>


  • โฌ‡๏ธ ajaxId_ok.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
	
	String userId = request.getParameter("userId");
	String str = "";
	
	if(!userId.equals("")){
		
		if(userId.startsWith("suzi")){
			
			str = userId + "๋Š” ์œ ํšจํ•œ ์•„์ด๋”” ์ž…๋‹ˆ๋‹ค";
		
		}else{

			str = userId + "๋Š” ์œ ํšจํ•œ ์•„์ด๋””๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค";
		
		}
		
	}
	
%>


<%=str %>



5. ์‹œ๊ฐ„ ๋ณด์—ฌ์ฃผ๊ธฐ (์„œ๋ฒ„์‹œ๊ฐ„ x)

  • `setTimeout("requestTime()",1000);` 

setTimeout : ์ž๊ธฐ์ž์‹ ์„ ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ์‹œ๊ฐ„์— ๋งž์ถฐ์„œ ๊ณ„์† ๋ฐ˜๋ณต๋˜์–ด์„œ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ

โœ๏ธ Test5.

๐Ÿ’ป ์ž…๋ ฅ

  • โฌ‡๏ธ clock.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<script type="text/javascript" src="<%=cp%>/data/js/ajaxUtil.js"></script>
<script type="text/javascript">

	//var xmlHttp = new XMLHttpRequest();
	
	function printClientTime() {
		
		var clientTime = document.getElementById("clientTime");
		
		var now = new Date();
		
		var timeStr = now.getFullYear() + "๋…„ " + (now.getMonth()+1) + "์›” " + now.getDate() + "์ผ " 
		+ now.getHours() + "์‹œ " + now.getMinutes() + "๋ถ„ " + now.getSeconds() + "์ดˆ";
		
		clientTime.innerHTML = timeStr;
		
		setTimeout("printClientTime()",1000);
	}

	function requestTime(){
		
		//์„œ๋ฒ„์ฐพ์•„๊ฐ€์•ผํ•จ
		//xmlHttp.open("GET", "clock_ok.jsp",true);
		//xmlHttp.onreadystatechange = printServerTime;
		//xmlHttp.send(null);
		
		sendRequest("clock_ok.jsp", null, printServerTime,"GET");
		
		setTimeout("requestTime()",1000);
		
	}
	
	function printServerTime() {
		
		if(xmlHttp.readyState==4){
			if(xmlHttp.status==200){
				
				var serverTime = 
					document.getElementById("serverTime");
				
				serverTime.innerHTML = xmlHttp.responseText;
				
			}
		}
		
	}
	
	
	window.onload = function () {
		printClientTime();
		requestTime();
	}

</script>
</head>
<body>

1.ํ˜„์žฌ ํด๋ผ์ด์–ธํŠธ ์‹œ๊ฐ„์€ <b><span id="clientTime"></span></b>์ž…๋‹ˆ๋‹ค.<br/>
2.ํ˜„์žฌ ์„œ๋ฒ„ ์‹œ๊ฐ„์€ <b><span id="serverTime"></span></b>์ž…๋‹ˆ๋‹ค.<br/>

</body>
</html>
  • โฌ‡๏ธ clock_ok.jsp
<%@page import="java.util.Date"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>

<%=new Date() %> <!-- ์„œ๋ฒ„์˜ ์‹œ๊ฐ„ -->





6.CSV

โœ๏ธ Test6.

๐Ÿ’ป ์ž…๋ ฅ

  • csv : , ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ / ์„œ๋กœ ๊ธฐ์ข…๊ฐ„์˜ ํ˜ธํ™˜์„ ์œ„ํ•ด
  • setTimeout(newsTitle,3000); : ๊ณ„์† ๋ณ€ํ•˜๋Š”๊ฑฐ
  • โฌ‡๏ธ newsTitleCSV.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!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>

<style type="text/css">

.news{
	font-size: 9pt;
	display: block;
	margin: 0 auto;
	background: lightgray;
	color: blue;
	border: 1px dashed black;
	width: 50%;
}

.newsError{
	font-size: 9pt;
	display: block;
	margin: 0 auto;
	background: orange;
	color: red;
	border: 1px dashed black;
	width: 50%;
}


</style>

<script type="text/javascript" src="<%=cp%>/data/js/ajaxUtil.js"></script>

<script type="text/javascript">

	function newsTitle() {
		
		//hideNewsTitle();
		
		sendRequest("newsTitleCSV_ok.jsp",null,displayNewsTitle,"GET");
		
	}
	
	function displayNewsTitle() {
		
		if(xmlHttp.readyState==4){
			if(xmlHttp.status==200){
				
				var csvStr = xmlHttp.responseText;
				//alert(csvStr);
				
				var csvArray = csvStr.split("|");
				
				var countStr = csvArray[0];
				//alert(countStr);
				
				if(countStr==0){
					alert("News๊ฐ€ ์—†๋‹ค");
					return;
				}
				
				var csvData = csvArray[1];
					//alert(csvData);
					
				var newsTitleArray = csvData.split("*");
					//alert(newsTitleArray.length);
					
				var html = "";
				
				html += "<ol>";
				
				for(var i=0; i<newsTitleArray.length;i++){
					var newsTitle = newsTitleArray[i];
					html += "<li>" + newsTitle + "</li>";
				}
				
				html += "<ol>";
				//alert(html);
				
				var newsDiv = document.getElementById("newsDiv");
				newsDiv.innerHTML = html;
			}
		}
		
	}
	
	function showNewsDiv() {
		var newsDiv = document.getElementById("newsDiv");
		newsDiv.style.display = "block";
	}
	
	function hideNewsDiv() {
		var newsDiv = document.getElementById("newsDiv");
		newsDiv.style.display = "none";
	}
	
	window.onload = function() {
		newsTitle();
	}




</script>

</head>
<body>

<h2>ํ—ค๋“œ๋ผ์ธ ๋‰ด์Šค</h2>

<hr/>
<br/>

<div onmouseover="showNewsDiv();" onmouseout="hideNewsDiv();" style="display: block; border: 3px solid; width: 50%; margin: 0 auto;">๋‰ด์Šค๋ณด๊ธฐ</div>

<div id="newsDiv" class="news"></div>

<hr/>

</body>
</html>


  • โฌ‡๏ธ newsTitleCSV_ok.jsp //๋‰ด์Šค๊ธฐ์‚ฌ

<%@page import="java.util.Date"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri = "http://java.sun.com/jsp/jstl/core" %> 
<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>


<!-- ! = ์ „์—ญ๋ณ€์ˆ˜๋กœ ๋น ์ง€๊ธฐ -->
<%!

	String[] newsTitle = { 

			"๊น€๊ฒฝ์œจ, ์œค ๋Œ€ํ†ต๋ น '๋ช…ํ’ˆ๋ฐฑ' ์ž…์žฅ์— '๋‹ค์„ฏ๊ธ€์ž๋กœ ์•„์‰ฝ์Šต๋‹ˆ๋‹ค'",
			"๋ช…๋™ ์ƒ๊ถŒ์ด ๋‹ฌ๋ผ์กŒ๋‹คโ€ฆ ์™ธ๊ตญ์ธ ๊ด€๊ด‘๊ฐ ์ฆ๊ฐ€์— '1์œ„ ์ƒ๊ถŒ' ํƒˆํ™˜",
			"'์ € ์„ฑ์ธ์ธ๋ฐ์š”' ๊ฑฐ์ง“๋ง์— ์†์•„ ์ˆ ยท๋‹ด๋ฐฐ ํŒ๋งคํ•œ ์—…์ฃผ๋Š” '๊ตฌ์ œ'",
			"๋ฒ•์› '๋Œ€ํ†ต๋ น์‹ค, ์œค ๋Œ€ํ†ต๋ น ๋ถ€์‚ฐ ํšŸ์ง‘ ํšŒ์‹๋น„ ๊ณต๊ฐœํ•ด์•ผ'",
			"๊ฐ€์Šด์ด ๋จน๋จนยทยทยท์–ผ์Œ ์นจ๋Œ€ ์œ„ ๋ถ๊ทน๊ณฐ์˜ '๋ถˆ์•ˆํ•œ ์ชฝ์ž '",
			"'์„ ๊ฑฐ๋ฒ• ์œ„๋ฐ˜' ์ž„์ข…์„ฑ, ์ง•์—ญ 4์›”ยท์ง‘์œ  2๋…„ ํ™•์ •ยทยทยท์˜์›์ง ์ƒ์‹ค"
			
	};

	/*
	6|๊น€๊ฒฝ์œจ, ์œค ๋Œ€ํ†ต๋ น '๋ช…ํ’ˆ๋ฐฑ' ์ž…์žฅ์— '๋‹ค์„ฏ๊ธ€์ž๋กœ ์•„์‰ฝ์Šต๋‹ˆ๋‹ค'[2024-02-02 ์˜คํ›„2:21]*
	๋ช…๋™ ์ƒ๊ถŒ์ด ๋‹ฌ๋ผ์กŒ๋‹คโ€ฆ ์™ธ๊ตญ์ธ ๊ด€๊ด‘๊ฐ ์ฆ๊ฐ€์— '1์œ„ ์ƒ๊ถŒ' ํƒˆํ™˜[2024-02-02 ์˜คํ›„2:21]*
	.
	.
	.
	*/


%>


<%
	out.print(newsTitle.length + "|"); //๋ฐฐ์—ด์•ˆ์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ 6(์ค„)๊ฐœ๊ฐ€ ๋“ค์–ด์˜ด 
	
	for(int i = 0; i<newsTitle.length;i++){
		out.print(newsTitle[i]+"[" + new Date() + "]");
		
		if(i!=(newsTitle.length-1)){
			out.print("*");
		}
		
		
	}

%>
---

![](https://velog.velcdn.com/images/_ddu2ni/post/7e9594ae-6932-4cf9-8ac0-c7a5d5dde074/image.png)



![](https://velog.velcdn.com/images/_ddu2ni/post/fa7b7e1f-2e97-458e-b331-e6713f1a1f3f/image.png)

---


0๊ฐœ์˜ ๋Œ“๊ธ€