일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- #C언어#do#while#계산기#함수
- #alert#자바스크립트#checkbox#alert
- #클릭#숨기기#보이기
- #자바스크립트#접속시간#시간
- #db#where
- #alert#자바스크립트#radio#check
- #C언어#숫자비교#삼항연산자
- #db#order#by
- #C언어#scanf#fflush
- #자바스크립트#텍스트#알람#alert
- #자바스크립트#만년달력#달력
- #select#from#distinct
- #자바스크립트#alert
- #C언어#do#while#계산기
- #C언어#for#간단#예제
- #getElementById#id
- #C언어#타입#printf
- #html#테이블#table
- #자바스크립트#회원가입#유효성#검사
- #C언어#성적처리#점수#등급
- #C언어#사각형
- #증감#연산자
- #db#데이터베이스#select
- #jQuery#mouse#over
- #자바스크립트#시계#실시간시계
- #C언어#if
- #db#join#inner#cross
- #db#froup#by
- #C언어#switch#case#계산기#함수
- #html#프레임
- Today
- Total
선택장애
JSP - Forward_Action, response.sendRedirect 본문
Foward Action태그는 다른 페이지로 프로그램의 제어를 이동할 때 사용되는 액션 태그이다.
여기서는 총 3페이지를 만들어서 넘겨보겠습니다.
response.senRedirect태그는 한 페이지까지만 이동할 수 있는 태그이다.
/////////////////////////////////////////////////////////////////////////////////////////////////////
Forward1.jsp
/////////////////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<% request.setCharacterEncoding("EUC-KR"); %>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form name="form1" action="Forward2.jsp" method="post">
//두번째 페이지인 Forward2로 넘기는 액션
<h2 align="center"> 테스트 폼11111</h2>
forward action : <input type ="text" name="name1"><input type="submit" name="button" value="확인"> <br><br>
</form>
<form method="form1" action=response_sendRedirect.jsp>
response.sendRedirect : <input type="text" name="name2">
<input type=submit value="확인">
</form>
</body>
</html>
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Forward2.jsp
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<%
String name10 = request.getParameter("name1");
//name을 받을 객체 생성
String name11 = request.getParameter("name2");
%>
<body>
<jsp:forward page="Forward3.jsp">
//3페이지(Forward3)로 넘기기
<jsp:param name="name1" value="<%=name10 %>"/>
<jsp:param name="name2" value="000-000-0000"/>
</jsp:forward>
</body>
</html>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Forward3.jsp
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h2>Forward3 에서 Forward2 호출</h2>
<hr>
Forward2 의 내용 출력
이름 : <%= request.getParameter("name1") %>
전화번호 : <%= request.getParameter("name2") %>
</body>
</html>
1페이지 > 2페이지 > 3페이지로 넘겨졌다.
1페이지에서는 보이는 부분
2페이지에서는 기능적인 제어기능
3페이지에서는 출력기능을 하였다.
(3페이지의 url을 보면 2페이지가 찍혀있다.)
'JSP' 카테고리의 다른 글
JSP - 장바구니(물건추가, 로그아웃)Session (0) | 2017.08.14 |
---|---|
JSP - Application(name이름넘기기, count값 올리기) (0) | 2017.08.14 |
JSP - Sesstion(alert) (0) | 2017.08.14 |
JSP - request사용하기 (select와 checkbox값받기) (0) | 2017.08.14 |