Day02(redirect)

2021. 10. 5. 19:17ยท๐Ÿ“† Today I Learned(๊ฐœ๋ฐœ์–ธ์–ดํ•™์Šต)/JSP

11redirect.jsp์˜ ์ฝ”๋“œ๋‚ด์šฉ

<%@page import="java.net.URLEncoder"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
๋‚˜๋Š” ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ์ „ ํŽ˜์ด์ง€

<%
	String name="์ฐฝ๋ฏผ";
	String encodedName = URLEncoder.encode(name, "utf-8");
	
	response.sendRedirect("11redirectPage.jsp?name=" + encodedName); // ํฌ๋กฌ์•„, ๋„ˆ ์ฃผ์–ด์ง„ ์ฃผ์†Œ๋กœ ๋‹ค์‹œํ•œ๋ฒˆ ์š”์ฒญํ•ด๋ผ
%>

<!-- 
	์•„์ด๋”” :
	๋น„๋ฐ€๋ฒˆํ˜ธ :
	๋กœ๊ทธ์ธ(loginCheck.jsp)  ํšŒ์›๊ฐ€์ž…
	
	loginCheck.jsp ๋‚ด์šฉ์€ ์•„์ด๋””, ๋น„๋ฐ€๋ฒˆํ˜ธ ํ™•์ธํ•˜๋Š” ๋‚ด์šฉ
	if(๋กœ๊ทธ์ธ์„ฑ๊ณต){
		redirect ํ™ˆ ํ™”๋ฉด
	}
 -->



</body>
</html>

11redirectPage.jsp์˜ ์ฝ”๋“œ๋‚ด์šฉ

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%=request.getParameter("name")%>
</body>
</html>

 

redirect๋Š” 2๋ฒˆ ์š”์ฒญํ•œ๋‹ค. ๋ฌด์Šจ๋ง์ด๋ƒ๋ฉด

์œ„ ์ฝ”๋“œ์˜ ๊ฒฝ์šฐ url์š”์ฒญ์‹œ http://localhost:8080/study/01basic/11redirect.jsp?name=์ฐฝ๋ฏผ ์œผ๋กœ ์ ‘๊ทผ์‹œ

url์€ http://localhost:8080/study/01basic/11redirectPage.jsp?name=์ฐฝ๋ฏผ ์œผ๋กœ ๋ฐ”๋€๋‹ค.

์™œ?

11redirect.jsp๋ฅผ ๋ณด๋ฉด response.sendRedirect("11redirectPage.jsp?name=" + encodedName); ๋ฅผ ํ†ตํ•ด์„œ ๋‹ค์‹œํ•œ๋ฒˆ ์š”์ฒญํ•˜๋„๋ก ๋˜์–ด์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๊ทธ๋ฆฌ๊ณ  11redirectPage.jsp์—์„œ๋Š” request.getParameter("name") ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ’์„ ๊ฐ–๊ณ  ์˜ค๊ธฐ ๋•Œ๋ฌธ์— ๊ฒฐ๊ณผ์ ์œผ๋กœ url์ด ๋ณ€๊ฒฝ๋œ๋‹ค.

์ €์ž‘์žํ‘œ์‹œ (์ƒˆ์ฐฝ์—ด๋ฆผ)

'๐Ÿ“† Today I Learned(๊ฐœ๋ฐœ์–ธ์–ดํ•™์Šต) > JSP' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Day02(declaration)์„ ์–ธ์‹ !  (0) 2021.10.05
Day02(servlet, jsp)  (0) 2021.10.05
Day02(aboutRequest)  (0) 2021.10.05
Day01(ํƒ€์ž…๋ณ€ํ™˜)  (0) 2021.10.05
Day01(img)  (0) 2021.10.05
'๐Ÿ“† Today I Learned(๊ฐœ๋ฐœ์–ธ์–ดํ•™์Šต)/JSP' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • Day02(declaration)์„ ์–ธ์‹ !
  • Day02(servlet, jsp)
  • Day02(aboutRequest)
  • Day01(ํƒ€์ž…๋ณ€ํ™˜)
JinSeong
JinSeong
์žฌ๋ฏธ์—†์œผ๋ฉด ์•ˆํ•œ๋‹ค.
  • JinSeong
    As you think, so shall you become.
    JinSeong
  • ์ „์ฒด
    ์˜ค๋Š˜
    ์–ด์ œ
    • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (96)
      • ๐Ÿ“† Today I Learned(๊ฐœ๋ฐœ์–ธ์–ดํ•™์Šต) (76)
        • JAVA (20)
        • HTML (1)
        • JSP (46)
        • SPRING (2)
        • ORACLE(DB) (6)
        • CSS (1)
      • ๐Ÿ“† Today I Learned(์ฝ”๋”ฉํ…Œ์ŠคํŠธ) (0)
        • JAVA (0)
      • Computer Science (9)
        • ์ปดํ“จํ„ฐ ๊ตฌ์กฐ (9)
        • ์šด์˜์ฒด์ œ (0)
        • ์ž๋ฃŒ๊ตฌ์กฐ & ์•Œ๊ณ ๋ฆฌ์ฆ˜ (0)
        • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค (0)
      • ์ฐฝ๊ณ  (11)
        • ๊ธฐ์ดˆ์ง€์‹ (7)
        • ํŒŒ์ผ์ฐฝ๊ณ  (0)
        • ๊ธฐ์ˆ ์ง€์‹์ฐฝ๊ณ  (0)
        • ๋ฒ„๊ทธ๋ฒ„๊ทธ ๐Ÿ‘€ (4)
      • Tools๐Ÿ”ง (0)
  • ๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

    • ํ™ˆ
    • ํƒœ๊ทธ
    • ๋ฐฉ๋ช…๋ก
  • ๋งํฌ

  • ๊ณต์ง€์‚ฌํ•ญ

  • ์ธ๊ธฐ ๊ธ€

  • ํƒœ๊ทธ

    Oracle
    java json๋ฆฌํ„ด ์—๋Ÿฌ
    SQL
    java ์Šค์ผ€์ค„๋Ÿฌ
    ALU
    ์ œ์–ด์žฅ์น˜
    java๋ฒ„์ „ ํ‘œํ˜„
    ์ดํด๋ฆฝ์Šค ์˜ค๋ฒ„๋ผ์ด๋”ฉ ๋ฉ”์†Œ๋“œ ์ž๋™ ์ƒ์„ฑ ๊ธฐ๋Šฅ
    java ๊ฐ์ฒดํƒ€์ž…ํ™•์ธ
    DB
    no converter found for
    ๋ ˆ์ง€์Šคํ„ฐ
    substring()
    spring ์Šค์ผ€์ค„๋Ÿฌ
    JAVA๋ฌธ์ž์—ด์ž๋ฅด๊ธฐ
    CPU
    jdk๊ตฌ๋ถ„
    ๋ช…๋ น์–ด
    ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์ฐจ์ด
    instanceof ์—ฐ์‚ฐ์ž
  • ์ตœ๊ทผ ๋Œ“๊ธ€

  • ์ตœ๊ทผ ๊ธ€

  • hELLOยท Designed By์ •์ƒ์šฐ.v4.10.3
JinSeong
Day02(redirect)
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”