์ƒˆ์†Œ์‹

์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด

๐ŸŒ WEB/๐Ÿ“ฐ HTML

HTML ๊ธฐ์ดˆ - JSP

  • -
๋ฐ˜์‘ํ˜•
JSP์˜ ํŠน์ง•

- JAVA + HTML

- ๋™์  ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ปดํฌ๋„ŒํŠธ

- .jsp ํ™•์žฅ์ž

- HTML๋ฌธ์„œ ์•ˆ์— ์ž๋ฐ” ์–ธ์–ด๊ฐ€ ์žˆ๋‹ค

- jsp๋Š” ์„œ๋ธ”๋ฆฟ์œผ๋กœ ๋ณ€ํ™˜๋˜์–ด ์‹คํ–‰ํ•œ๋‹ค

- MVC ํŒจํ„ด์—์„œ View๋กœ ์ด์šฉ๋œ๋‹ค

 

JSP์˜ ํƒœ๊ทธ

์ง€์‹œ์ž : ํŽ˜์ด์ง€ ์†์„ฑ <%@ ํ…์ŠคํŠธ %>

์„ ์–ธ : ๋ณ€์ˆ˜, ๋ฉ”์†Œ๋“œ ์„ ์–ธ <%! ํ…์ŠคํŠธ %>

ํ‘œํ˜„์‹ : ๊ฒฐ๊ณผ ๊ฐ’ ์ถœ๋ ฅ <%= ํ…์ŠคํŠธ %>

์Šคํฌ๋ฆฝํŠธ๋ฆฟ : JAVA ์ฝ”๋“œ <% ํ…์ŠคํŠธ %>

์ฃผ์„ : <%-- ํ…์ŠคํŠธ --%>

์•ก์…˜ ํƒœ๊ทธ : ํŽ˜์ด์ง€ ๋‚ด์— ๋™์ž‘ ์ง€์‹œ <jsp: > ํ…์ŠคํŠธ </jsp: >

// gugudan.jsp

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
	<%
		//   ์ดˆ๊ธฐ๊ฐ’ ; ์กฐ๊ฑด๊ฐ’ ; ์ฆ๊ฐ๊ฐ’
		for(int i=1 ; i<10 ; i++){
			out.print("2 x " + i + "=" + (2*i) + "<br>");
		}
	%>

</body>
</html>

// gugudan.jsp

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
	<%
		String gugudan = request.getParameter("gugudan");
		int gugudanInt = Integer.parseInt(gugudan);
		//   ์ดˆ๊ธฐ๊ฐ’	; ์กฐ๊ฑด๊ฐ’ ; ์ฆ๊ฐ๊ฐ’
		for(int i=1 ; i<10 ; i++){
			out.print(gugudanInt + " x " + i + "=" + (gugudanInt*i) + "<br>");
		}
	%>
	
</body>
</html>
//gugudan-form.jsp

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
	<h1>๊ตฌ๊ตฌ๋‹จ ํ™•์ธ</h1>
	<form action="gugudan.jsp" method="get">
		๋ช‡๋‹จ? : <input type="text" name="gugudan" >
		<input type="submit" value="ํ™•์ธ">
	</form>
</body>
</html>

1. ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ : http://localhost:9090/html/gugudan-form.jsp URL ์š”์ฒญ

2. ์„œ๋ฒ„ : gugudan-form.jsp ์ฐพ์Œ

3. gugudan-form.jsp html ๋ฌธ์„œ(์ฝ”๋“œ) ์‘๋‹ต์œผ๋กœ ์คŒ

4. ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ ( ๊ฐ’ ์ž…๋ ฅ ํ›„ ํ™•์ธ ๋ฒ„ํŠผ ํด๋ฆญ ) : form ํƒœ๊ทธ๋กœ ์„œ๋ฒ„์— ์š”์ฒญ

5. ์„œ๋ฒ„ : gugudan.jsp ์ฐพ์Œ - request์— gugudan ๋ณ€์ˆ˜ ๊ฐ’์„ ๊ฐ€์ ธ๊ฐ - gugudan.jsp ๋™์ž‘ ( ๋™์ ํŽ˜์ด์ง€ ) ํ›„ ์‘๋‹ต

- gugudan.jsp html ๋ฌธ์„œ(์ฝ”๋“œ)๋กœ ์‘๋‹ต์„ ์คŒ 

๋ฐ˜์‘ํ˜•

'๐ŸŒ WEB > ๐Ÿ“ฐ HTML' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

HTML ๊ธฐ์ดˆ - ์„ธ์…˜  (0) 2022.06.15
HTML ๊ธฐ์ดˆ - ์ฟ ํ‚ค  (0) 2022.06.15
HTML ๊ธฐ์ดˆ - CSS  (0) 2022.06.15
HTML ๊ธฐ์ดˆ - ๋กœ๊ทธ์ธ ์ฐฝ  (0) 2022.06.15
HTML ๊ธฐ์ดˆ  (0) 2022.06.15
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.