selectPage.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>
<style>
div {
width: 200px;
margin: 0px auto;
background-color: yellow;
color: green;
text-align: center;
}
</style>
</head>
<body>
<form action="moveURL.jsp">
<div>
<select name="url">
<option value="http://www.naver.com">네이버</option>
<!-- value를 통해 '네이버'라는 글자를 url롤 보내기 대신 value 값을 url로 전달 -->
<option value="http://www.daum.net">다음</option>
<option value="http://www.google.com">구글</option>
</select> <input type="submit" value="이동">
</div>
</form>
</body>
</html>
moveURL.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>
<%
response.sendRedirect(request.getParameter("url"));
%>
</body>
</html>
'Programming > Servlet & JSP' 카테고리의 다른 글
체크박스 EL식으로 값 가져오기 (0) | 2020.02.23 |
---|---|
EL 연습하기 (0) | 2020.02.23 |
랜덤 당첨 (0) | 2020.02.23 |
방문자수 (0) | 2020.02.20 |
방명록(어플리케이션) (0) | 2020.02.20 |