[MVC 3-5] EL - Array

์ž„์Šนํ˜„ยท2023๋…„ 1์›” 25์ผ
0

MVC

๋ชฉ๋ก ๋ณด๊ธฐ
7/27

๐Ÿ“ƒstring_array.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String[] nameArray={"ํ™๊ธธ๋™","์ž„๊บฝ์ •","์ „์šฐ์น˜","์ผ์ง€๋งค","์žฅ๊ธธ์‚ฐ"};
	request.setAttribute("nameArray", nameArray);
	//
	request.getRequestDispatcher("string_array_el.jsp").forward(request, response);
%>

๐Ÿ“ƒstring_array_el.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>MVC</title>
</head>
<body>
	<h1>EL - Array</h1>
	<hr>
	<ul>
		<%-- ์Šค์ฝ”ํ”„ ์†์„ฑ๊ฐ’์ด ๋ฐฐ์—ด์ธ ๊ฒฝ์šฐ ๋ฐฐ์—ด ์š”์†Œ๊ฐ’์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด EL ํ‘œํ˜„์‹์—์„œ . ์—ฐ์‚ฐ์ž๋กœ
		์ฒจ์ž(Index)๋ฅผ ํ‘œํ˜„ํ•œ ๊ฒฝ์šฐ ELException ๋ฐœ์ƒ - . ์—ฐ์‚ฐ์ž ์‚ฌ์šฉ ๋ถˆ๊ฐ€๋Šฅ --%>
		<%-- <li>${nameArray.0 }</li> --%>
		<%-- ์Šค์ฝ”ํ”„ ์†์„ฑ๊ฐ’์ด ๋ฐฐ์—ด์ธ ๊ฒฝ์šฐ ๋ฐฐ์—ด ์š”์†Œ๊ฐ’์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด EL ํ‘œํ˜„์‹์—์„œ [] ์—ฐ์‚ฐ์ž๋กœ๋งŒ
		์ฒจ์ž(Index)๋ฅผ ํ‘œํ˜„ํ•˜์—ฌ ์š”์†Œ๊ฐ’์„ ์ œ๊ณต๋ฐ›์•„ ์ถœ๋ ฅ --%>
		<%-- <li>${nameArray["0"] }</li> --%><%-- ์ฒจ์ž๋Š” " " ๊ธฐํ˜ธ ์ƒ๋žต ๊ฐ€๋Šฅ --%>
		<li>${nameArray[0] }</li>
		<li>${nameArray[1] }</li>
		<li>${nameArray[2] }</li>
		<li>${nameArray[3] }</li>
		<li>${nameArray[4] }</li>
		<%-- EL ํ‘œํ˜„์‹์˜ ์ฐธ์ž๊ฐ€ ๋ฐฐ์—ด ์š”์†Œ์˜ ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚œ ๊ฒฝ์šฐ EL ๋ฏธ์‹คํ–‰ - ๋ฏธ์ถœ๋ ฅ --%>
		<li>${nameArray[5] }</li>
	</ul>
</body>
</html> 

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