<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page errorPage="errorPage_error.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
name 파라미터 : <%=request.getParameter("name").toUpperCase() %>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
오류가 발생했습니다.
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page errorPage="isErrorPage_error.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
name 파라미터 : <%=request.getParameter("name").toUpperCase() %>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isErrorPage="true"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<p>오류가 발생하였습니다.</p>
<p>
예외 유형 :
<%=exception.getClass().getName()%></p>
<p>
오류 메시지 :
<%=exception.getMessage()%></p>
<p>
toString :
<%=exception.toString()%></p>
<p>
printStackTrace :
<%=exception.printStackTrace()%></p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="exception_process.jsp" method="post">
<p> 숫자 1 : <input type="text" name="num1"></p>
<p> 숫자 2 : <input type="text" name="num2"></p>
<p> <input type="submit" value="나누기"></p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page errorPage="exception_error.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String num1 = request.getParameter("num1");
String num2 = request.getParameter("num2");
int a = Integer.parseInt(num1);
int b = Integer.parseInt(num2);
int c= a/b;
out.print(num1 + "/" + num2 + " = " + c);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<p>오류가 발생하였습니다</p>
<p> 예외 : <%=exception %></p>
<p> toString() : <%=exception.toString() %></p>
<p> getClass().getName() : <%=exception.getClass().getName() %></p>
<p> getMessage() : <%=exception.getMessage() %>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<security-role>
<role-name>guest</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>JSPBook</web-resource-name>
<url-pattern>/Book/addBook.jsp</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description></description>
<role-name>guest</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/Book/login.jsp</form-login-page>
<form-error-page>/Book/login_failed.jsp</form-error-page>
</form-login-config>
</login-config>
<error-page>
<error-code>500</error-code>
<location>/ch11/errorCode_error.jsp</location>
</error-page>
</web-app>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="errorCode_process.jsp" method="post">
<p> 숫자 1 : <input type="text" name="num1"></p>
<p> 숫자 2 : <input type="text" name="num2"></p>
<p> <input type="submit" value="나누기"></p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String num1 = request.getParameter("num1");
String num2 = request.getParameter("num2");
int a = Integer.parseInt(num1);
int b = Integer.parseInt(num2);
int c = a / b;
out.print(num1 + "/" + num2 + " = " + c);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
errorCode 505 오류가 발생하였습니다
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<security-role>
<role-name>guest</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>JSPBook</web-resource-name>
<url-pattern>/Book/addBook.jsp</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description></description>
<role-name>guest</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/Book/login.jsp</form-login-page>
<form-error-page>/Book/login_failed.jsp</form-error-page>
</form-login-config>
</login-config>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/ch11/exceptionType_error.jsp</location>
</error-page>
</web-app>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="exceptionType_process.jsp" method="post">
<p>
숫자 1 : <input type="text" name="num1">
</p>
<p>
숫자 2 : <input type="text" name="num2">
</p>
<p>
<input type="submit" value="나누기">
</p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String num1 = request.getParameter("num1");
String num2 = request.getParameter("num2");
int a = Integer.parseInt(num1);
int b = Integer.parseInt(num2);
int c = a / b;
out.print(num1 + "/" + num2 + " = " + c);
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
exception type 오류가 발생하였습니다
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="tryCatch_process.jsp" method="post">
<p>
숫자 1 : <input type="text" name="num1">
</p>
<p>
숫자 2 : <input type="text" name="num2">
</p>
<p>
<input type="submit" value="나누기">
</p>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<p>잘못된 데이터가 입력되었습니다</p>
<P><%=" 숫자1 : "+request.getParameter("num1") %></P>
<P><%=" 숫자2 : "+request.getParameter("num2") %></P>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
try {
String num1 = request.getParameter("num1");
String num2 = request.getParameter("num2");
int a = Integer.parseInt(num1);
int b = Integer.parseInt(num2);
int c = a / b;
} catch (NumberFormatException e) {
RequestDispatcher dispatcher = request.getRequestDispatcher("tryCatch_error.jsp");
dispatcher.forward(request, response);
}
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품 아이디 오류</title>
<style>
.banner .container {
height : 100%;
display: flex;
align-items : center;
}
.banner .container .banner_error {
background-color: #fc8686;
color : #d12c2c;
height: 7vw;
width : 100%;
font-size : 5vw;
overflow: hidden;
line-height: 1.5;
}
p {
margin : 30px 0;
}
</style>
</head>
<body>
<jsp:include page="header.jsp"/>
<div class="main">
<div class="banner">
<div class="container">
<h2 class="banner_error">해당 상품이 존재하지 않습니다.</h2>
</div>
</div>
<div class="content">
<div class="container">
<p><%=request.getRequestURI() %><%=request.getQueryString() %></p>
<p><a href="products.jsp" class="btn">상품 목록»</a>
</div>
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="dto.Product"%>
<%@ page import="dao.ProductRepository"%>
<%@ page errorPage="exceptionNoProductId.jsp" %>
<jsp:useBean id="productDAO" class="dao.ProductRepository"
scope="session" />
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품 상세 정보</title>
<style>
.content .row {
padding: 30px 0;
display : flex;
}
.content .row div {
padding : 10px;
}
.content h3, .content p, .content h4 {
margin: 25px 0;
}
.content h3 {
margin-bottom: 5px;
}
.content .description {
margin-top: 5px;
}
.content .badge {
background-color: #f00;
color: #fff;
border-radius: 5px;
}
</style>
</head>
<body>
<jsp:include page="header.jsp" />
<div class="main">
<div class="banner">
<div class="container">
<h1>상품 정보</h1>
</div>
</div>
<%
String id = request.getParameter("id");
ProductRepository dao = ProductRepository.getInstance();
Product product = dao.getProductById(id);
%>
<div class="content">
<div class="container">
<div class="row">
<div>
<img alt="상품 사진" style="width:100%"
src="c:/upload/<%=product.getFilename()%>">
</div>
<div>
<h3><%=product.getPname()%></h3>
<p class="description"><%=product.getDescription()%></p>
<p>
<b>상품 코드 : </b><span class="badge"><%=product.getProductId()%></span>
<p>
<b>제조사</b> :
<%=product.getManufacturer()%></p>
<p>
<b>분류</b> :
<%=product.getCategory()%></p>
<p>
<b>재고 수</b> :
<%=product.getUnitInStock()%>
</p>
<h4><%=product.getUnitPrice()%>원
</h4>
<p>
<a href="#" class="btn btn-secondary">상품 주문 »</a> <a
href="./products.jsp" class="btn">상품 목록 »</a>
</p>
</div>
</div>
<hr>
</div>
</div>
</div>
<jsp:include page="footer.jsp" />
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<security-role>
<description></description>
<role-name>admin</role-name>
</security-role>
<security-constraint>
<display-name>WebMarket Security</display-name>
<web-resource-collection>
<web-resource-name>WebMarket</web-resource-name>
<description></description>
<url-pattern>/addProduct.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description></description>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login_failed.jsp</form-error-page>
</form-login-config>
</login-config>
<error-page>
<error-code>404</error-code>
<location>/exceptionNoPage.jsp</location>
</error-page>
</web-app>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>페이지 오류</title>
<style>
.banner .container {
height : 100%;
display: flex;
align-items : center;
}
.banner .container .banner_error {
background-color: #fc8686;
color : #d12c2c;
height: 7vw;
width : 100%;
font-size : 5vw;
overflow: hidden;
line-height: 1.5;
}
p {
margin : 30px 0;
}
</style>
</head>
<body>
<jsp:include page="header.jsp" />
<div class="main">
<div class="banner">
<div class="container">
<h2 class="banner_error">요청하신 페이지를 찾을 수 없습니다.</h2>
</div>
</div>
<div class="content">
<div class="container">
<p><%=request.getRequestURI() %></p>
<p><a href="products.jsp" class="btn">상품 목록»</a>
</div>
</div>
</div>
</body>
</html>