다음 경로에서 내장객체 확인가능 !
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body align = "center">
<form action="Ex03createlnput.jsp">
<fieldset>
<legend>랜덤숫자입력</legend>
<input type="number" name="num">
<br>
<br>
<input type="submit" value="생성하기">
</fieldset>
</form>
</body>
</html>
<%@page import="java.util.Random"%>
<%@ 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>
<form action="Ex03randomWinner.jsp">
<fieldset align ="center">
<legend>랜덤당첨 작성</legend>
<%
request.setCharacterEncoding("UTF-8");
int num = Integer.parseInt(request.getParameter("num"));
out.print("주제:<input type='text' name='title'><br>");
for(int i = 1; i <= num; i++){
out.print("아이템" + i + ":<input type='text' name='manu" + i + "'><br>");
}
%>
<input type="hidden" name="num" value=<%= num %>>
<input type="submit" value="시작">
</fieldset>
</form>
</body>
</html>
<%@page import="java.util.Random"%>
<%@ 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 align ="center">
<%
Random random = new Random();
int num = Integer.parseInt(request.getParameter("num"));
String manuTitle = null;
String manu = null;
while(true){
int ranNum = random.nextInt(num+1);
String what = "manu"+ranNum;
manuTitle = request.getParameter("title");
manu = request.getParameter(what);
if(manu.equals(null)){
continue;
} else {
break;
}
}
%>
<fieldset>
<legend>랜덤당첨결과</legend>
<p><%= manuTitle %></p>
<p><%= manu %></p>
</fieldset>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="Ex04NaverPage.jsp">
<input type="submit" value="네이버로 이동">
</form>
</body>
</html>
<%@ 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>
<%
// sendRedirect("요청 URL")
// : 웹 서버가 웹 브라우져(클라이언트)에게 이동할 url 주소를 알려줌
response.sendRedirect("http://www.naver.com");
%>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="Ex05url.jsp">
<select name="urlPage">
<option value="naver">네이버</option>
<option value="daum">다음</option>
<option value="google">구글</option>
</select>
<input type="submit" value="제출">
</form>
</body>
</html>
<%@ 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>
<%
// sendRedirect("요청 URL")
// : 웹 서버가 웹 브라우져(클라이언트)에게 이동할 url 주소를 알려줌
String url = request.getParameter("urlPage");
if(url.equals("naver")){
response.sendRedirect("http://www.naver.com");
} else if (url.equals("daum")){
response.sendRedirect("http://www.daum.net/");
} else if (url.equals("google")){
response.sendRedirect("http://www.google.com/");
}
%>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body align = "center">
<form action="Ex06Login.jsp">
<fieldset>
<legend>로그인</legend>
<input type="text" name="id">
<br>
<input type="password" name="pw">
<br>
<input type="submit" value="로그인">
</fieldset>
</form>
</body>
</html>
<%@ 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 align="center">
<%
String id = request.getParameter("id");
String pw = request.getParameter("pw");
if(id.equals("smart") && pw.equals("123")){
response.sendRedirect("Ex06LoginSuccess.jsp");
} else {
response.sendRedirect("Ex06LoginFail.jsp");
}
%>
</body>
</html>
<%@ 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 align="center">
<h3>Smart님 환영합니다!</h3>
<a href="Ex06Login.html">로그아웃</a>
</body>
</html>
<%@ 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 align="center">
<p>로그인정보를 다시 확인하세요.</p>
<a href="Ex06Login.html">로그인페이지</a>
</body>
</html>