728x90
<HTML:Ex15_makeURL>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action='./Ex15_makeURL.jsp'>
<select name="web">
<option value="http://www.naver.com">네이버 </option>
<option value="http://www.google.com">구글 </option>
<option value="http://www.youtube.com">유튜브 </option>
</select>
<input type = "submit" value = "제출">
</form>
</body>
</html>
<JSP:Ex15_makeURL >
<%@ 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>
<%
// 1. web 데이터 받아오기
String web = request.getParameter("web");
System.out.println(web);
// 2. 해당 url 이동 확인
response. sendRedirect(web);
%>
</body>
</html>
출처: 스마트인재개발원
728x90
반응형
'DATA 분석 교육 과정 (2024.02~08) > JSP&Servlet' 카테고리의 다른 글
JSP_Forward, sendRedirect, Scope (0) | 2024.04.16 |
---|---|
JSP_Session (0) | 2024.04.16 |
JSP_다른페이지로 이동하기 (0) | 2024.04.15 |
JSP_(실습) 학점 확인 프로그램 (0) | 2024.04.15 |
JSP_(실습) HTML>JSP>JSP (랜덤 메뉴 선택) (0) | 2024.04.15 |