+++ 202108/.settings/org.eclipse.core.resources.prefs
... | ... | @@ -0,0 +1,2 @@ |
1 | +eclipse.preferences.version=1 | |
2 | +encoding//src/main/webapp/0812/index.jsp=UTF-8 |
+++ 202108/src/main/java/study/Calc.java
... | ... | @@ -0,0 +1,28 @@ |
1 | +package study; | |
2 | + | |
3 | +public class Calc { | |
4 | + | |
5 | + int result = 0; | |
6 | + | |
7 | + public Calc(int num1, int num2, String op) { | |
8 | + | |
9 | + if(op.equals("+")){ | |
10 | + result = num1 + num2; | |
11 | + } | |
12 | + else if(op.equals("-")){ | |
13 | + result = num1 - num2; | |
14 | + } | |
15 | + else if(op.equals("*")){ | |
16 | + result = num1 * num2; | |
17 | + } | |
18 | + else { | |
19 | + result = num1 / num2; | |
20 | + } | |
21 | + | |
22 | + | |
23 | + } | |
24 | + public int getResult() { | |
25 | + return result; | |
26 | + } | |
27 | + | |
28 | +}(No newline at end of file) |
--- 202108/src/main/java/TestServlet.java
+++ 202108/src/main/java/study/CalcServlet.java
... | ... | @@ -1,4 +1,4 @@ |
1 |
- |
|
1 |
+package study; |
|
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 | 4 |
import java.io.PrintWriter; |
... | ... | @@ -9,17 +9,19 @@ |
9 | 9 |
import javax.servlet.http.HttpServletRequest; |
10 | 10 |
import javax.servlet.http.HttpServletResponse; |
11 | 11 |
|
12 |
+import org.apache.jasper.tagplugins.jstl.core.Out; |
|
13 |
+ |
|
12 | 14 |
/** |
13 |
- * Servlet implementation class TestServlet |
|
15 |
+ * Servlet implementation class CalcServlet |
|
14 | 16 |
*/ |
15 |
-@WebServlet("/TestServlet") |
|
16 |
-public class TestServlet extends HttpServlet { |
|
17 |
+@WebServlet("/CalcServlet") |
|
18 |
+public class CalcServlet extends HttpServlet { |
|
17 | 19 |
private static final long serialVersionUID = 1L; |
18 | 20 |
|
19 | 21 |
/** |
20 | 22 |
* @see HttpServlet#HttpServlet() |
21 | 23 |
*/ |
22 |
- public TestServlet() { |
|
24 |
+ public CalcServlet() { |
|
23 | 25 |
super(); |
24 | 26 |
// TODO Auto-generated constructor stub |
25 | 27 |
} |
... | ... | @@ -28,21 +30,36 @@ |
28 | 30 |
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
29 | 31 |
*/ |
30 | 32 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
31 |
- response.setContentType("text/html;charset-utf-8"); |
|
32 |
- PrintWriter out = response.getWriter(); |
|
33 | 33 |
|
34 |
- out.println("<html>"); |
|
35 |
- out.println("<head><title>This is Servlet Page</title></head>"); |
|
36 |
- out.println("<body><h2>HelloWorld!</h2></body>"); |
|
37 |
- out.println("</html>"); |
|
34 |
+ doPost(request, response); |
|
35 |
+ |
|
38 | 36 |
} |
39 | 37 |
|
40 | 38 |
/** |
41 | 39 |
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
42 | 40 |
*/ |
43 | 41 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
44 |
- // TODO Auto-generated method stub |
|
45 |
- doGet(request, response); |
|
42 |
+ |
|
43 |
+ response.setContentType("text/html;charset-utf-8"); |
|
44 |
+ |
|
45 |
+ int num1 = Integer.parseInt(request.getParameter("num1")); |
|
46 |
+ int num2 = Integer.parseInt(request.getParameter("num2")); |
|
47 |
+ String op = request.getParameter("op"); |
|
48 |
+ |
|
49 |
+ PrintWriter out = response.getWriter(); |
|
50 |
+ |
|
51 |
+ Calc calc = new Calc(num1, num2, op); |
|
52 |
+ int result = calc.getResult(); |
|
53 |
+ |
|
54 |
+ out.println("<html>"); |
|
55 |
+ out.println("<head><title>Calculator</title></head>"); |
|
56 |
+ out.println("<body>"); |
|
57 |
+ out.println("<h2>Calculating Result</h2>"); |
|
58 |
+ out.print(num1 + op + num2 + "=" + result); |
|
59 |
+ out.println("</body>"); |
|
60 |
+ out.println("</html>"); |
|
61 |
+ |
|
46 | 62 |
} |
47 | 63 |
|
48 | 64 |
} |
65 |
+ |
+++ 202108/src/main/webapp/0812/3.html
... | ... | @@ -0,0 +1,112 @@ |
1 | +<!doctype html> | |
2 | +<html lang="ko"> | |
3 | +<head> | |
4 | + <meta charset="UTF-8"> | |
5 | + <style> | |
6 | + * {margin: 0; padding: 0; box-sizing: border-box; color: #666666;} | |
7 | + body {background: no-repeat url("http://web.miri.kr/example/images/bg.jpg")fixed; background-size: cover;} | |
8 | + #container {width: 1030px; margin: 0 auto;background-color: white} | |
9 | + #top {background-color: #666666;} | |
10 | + #top ul li {display: inline-block; vertical-align: middle; margin-right: 40px;} | |
11 | + #top ul li a {text-decoration: none; color: white; font-weight: 600; font-size: large;} | |
12 | + #top ul li a:hover {color: black;} | |
13 | + #second {background: url("http://web.miri.kr/example/images/main1.jpg"); width: 1030px; height: 500px;} | |
14 | + #article {width: 1030px; height: 500px;} | |
15 | + #left {width: 70%; height: 500px; float: left;} | |
16 | + #right {width: 30%; height: 500px; float: left;} | |
17 | + #leftTop {height: 50%;} | |
18 | + #leftBottom {height: 50%;} | |
19 | + #leftTopLeft {width: 50%; height: 100%; float: left;} | |
20 | + #leftTopRight {width: 50%; height: 100%; float: left;} | |
21 | + #leftBottomLeft {width: 50%; height: 100%; float: left;} | |
22 | + #leftBottomRight {width: 50%; height: 100%; float: left;} | |
23 | + #img2 {width: 300px; height: 210px; margin-left: 25px; margin-top: 15px;} | |
24 | + #lorem1 {font-size: 25px;} | |
25 | + #lorem2 {font-size: 20px; color: #985d6a;} | |
26 | + #caption1 {margin-left: 25px;} | |
27 | + #this {margin-left: 10px; margin-top: 20px;} | |
28 | + #img3 {width: 300px; height: 210px; margin-left: 25px; margin-top: 15px;} | |
29 | + #rightTop {width: 100%; height: 50%;} | |
30 | + #rightBottom {width: 100%; height: 50%;} | |
31 | + #rightTop ul {margin-top: 10px;} | |
32 | + #rightTop ul li {list-style: none; margin-bottom: 20px;} | |
33 | + #rightTop ul li:hover {background-color: #aeaca8;} | |
34 | + #rightTop ul li a {text-decoration: none; color: #985d6a;} | |
35 | + #walking {font-size: 30px;} | |
36 | + #this0 {margin-top: 10px;} | |
37 | + #contact {font-size: 30px; color: #985d6a;} | |
38 | + #footer {background-color: #666666; color: white;} | |
39 | + </style> | |
40 | +</head> | |
41 | +<body> | |
42 | + <div id="container"> | |
43 | + <div id="top"> | |
44 | + <ul> | |
45 | + <li><a href="#"><img id="logo" src="http://www.aiit.or.kr/images/logo.png"></a></li> | |
46 | + <li><a href="#">Company</a></li> | |
47 | + <li><a href="#">Product</a></li> | |
48 | + <li><a href="#">Service</a></li> | |
49 | + <li><a href="#">Community</a></li> | |
50 | + <li><a href="#">Contact</a></li> | |
51 | + </ul> | |
52 | + </div> | |
53 | + <div id="second"> | |
54 | +<!-- 손 그림--> | |
55 | + </div> | |
56 | + <div id="article"> | |
57 | + <div id="left"> | |
58 | + <div id="leftTop"> | |
59 | + <div id="leftTopLeft"> | |
60 | + <img id="img2" src="http://web.miri.kr/example/images/image1.jpg"> | |
61 | + <p id="caption1">그림[1]</p> | |
62 | + </div> | |
63 | + <div id="leftTopRight"> | |
64 | + <p id="this0"> | |
65 | + <span id="lorem1">Lorem ipsum.</span><br> | |
66 | + <span id="lorem2">Lorem ipsum dolor sit amet.</span><br><br> | |
67 | + <span id="lorem3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. A dicta doloremque ea eaque eligendi excepturi exercitationem explicabo saepe sit. Consequatur delectus doloribus in magnam natus nesciunt nostrum odio soluta voluptatem!</span> | |
68 | + </p> | |
69 | + </div> | |
70 | + </div> | |
71 | + <div id="leftBottom"> | |
72 | + <div id="leftBottomLeft"> | |
73 | + <p id="this"> | |
74 | + <span id="lorem1">Lorem ipsum.</span><br> | |
75 | + <span id="lorem2">Lorem ipsum dolor sit amet.</span><br><br> | |
76 | + <span id="lorem3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. A dicta doloremque ea eaque eligendi excepturi exercitationem explicabo saepe sit. Consequatur delectus doloribus in magnam natus nesciunt nostrum odio soluta voluptatem!</span> | |
77 | + </p> | |
78 | + </div> | |
79 | + <div id="leftBottomRight"> | |
80 | + <img id="img3" src="http://web.miri.kr/example/images/image2.jpg"> | |
81 | + <p id="caption1">그림[2]</p> | |
82 | + </div> | |
83 | + </div> | |
84 | + </div> | |
85 | + <div id="right"> | |
86 | + <div id="rightTop"> | |
87 | + <ul> | |
88 | + <li><a id="walking" href="">Walking Exersise</a></li> | |
89 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
90 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
91 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
92 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
93 | + </ul> | |
94 | + </div> | |
95 | + <div id="rightBottom"> | |
96 | + <p id="lastText"> | |
97 | + <span id="contact">Contact Us</span><br><br> | |
98 | + <span>Gwangju Industrial Tools</span><br> | |
99 | + <span>Circulating Center,</span><br> | |
100 | + <span>Maewol-dong, Seo-gu,</span><br> | |
101 | + <span>Gwanju, korea</span><br> | |
102 | + <span>062-000-1111</span> | |
103 | + </p> | |
104 | + </div> | |
105 | + </div> | |
106 | + </div> | |
107 | + <div id="footer"> | |
108 | + Copyright©2019한국정보통신교육원 All rights reserved. | |
109 | + </div> | |
110 | + </div> | |
111 | +</body> | |
112 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/article.jsp
... | ... | @@ -0,0 +1,56 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | + <div id="second"> | |
4 | + <!--손 그림--> | |
5 | + </div> | |
6 | + <div id="article"> | |
7 | + <div id="left"> | |
8 | + <div id="leftTop"> | |
9 | + <div id="leftTopLeft"> | |
10 | + <img id="img2" src="http://web.miri.kr/example/images/image1.jpg"> | |
11 | + <p id="caption1">그림[1]</p> | |
12 | + </div> | |
13 | + <div id="leftTopRight"> | |
14 | + <p id="this0"> | |
15 | + <span id="lorem1">Lorem ipsum.</span><br> | |
16 | + <span id="lorem2">Lorem ipsum dolor sit amet.</span><br><br> | |
17 | + <span id="lorem3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. A dicta doloremque ea eaque eligendi excepturi exercitationem explicabo saepe sit. Consequatur delectus doloribus in magnam natus nesciunt nostrum odio soluta voluptatem!</span> | |
18 | + </p> | |
19 | + </div> | |
20 | + </div> | |
21 | + <div id="leftBottom"> | |
22 | + <div id="leftBottomLeft"> | |
23 | + <p id="this"> | |
24 | + <span id="lorem1">Lorem ipsum.</span><br> | |
25 | + <span id="lorem2">Lorem ipsum dolor sit amet.</span><br><br> | |
26 | + <span id="lorem3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. A dicta doloremque ea eaque eligendi excepturi exercitationem explicabo saepe sit. Consequatur delectus doloribus in magnam natus nesciunt nostrum odio soluta voluptatem!</span> | |
27 | + </p> | |
28 | + </div> | |
29 | + <div id="leftBottomRight"> | |
30 | + <img id="img3" src="http://web.miri.kr/example/images/image2.jpg"> | |
31 | + <p id="caption1">그림[2]</p> | |
32 | + </div> | |
33 | + </div> | |
34 | + </div> | |
35 | + <div id="right"> | |
36 | + <div id="rightTop"> | |
37 | + <ul> | |
38 | + <li><a id="walking" href="">Walking Exersise</a></li> | |
39 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
40 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
41 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
42 | + <li><a href="">Lorem ipsum dolor sit amet.</a></li> | |
43 | + </ul> | |
44 | + </div> | |
45 | + <div id="rightBottom"> | |
46 | + <p id="lastText"> | |
47 | + <span id="contact">Contact Us</span><br><br> | |
48 | + <span>Gwangju Industrial Tools</span><br> | |
49 | + <span>Circulating Center,</span><br> | |
50 | + <span>Maewol-dong, Seo-gu,</span><br> | |
51 | + <span>Gwanju, korea</span><br> | |
52 | + <span>062-000-1111</span> | |
53 | + </p> | |
54 | + </div> | |
55 | + </div> | |
56 | + </div>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/calc.html
... | ... | @@ -0,0 +1,20 @@ |
1 | +<!DOCTYPE html> | |
2 | +<html> | |
3 | +<head> | |
4 | +<meta charset="UTF-8"> | |
5 | +<title>Calculator</title> | |
6 | +</head> | |
7 | +<body> | |
8 | + <form action="/202108//CalcServlet" method="post"> | |
9 | + <input type="text" name="num1"> | |
10 | + <select name="op"> | |
11 | + <option value="+">+</option> | |
12 | + <option value="-">-</option> | |
13 | + <option value="*">*</option> | |
14 | + <option value="/">/</option> | |
15 | + </select> | |
16 | + <input type="text" name="num2"> | |
17 | + <input type="submit" value="Run"> | |
18 | + </form> | |
19 | +</body> | |
20 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/error.jsp
... | ... | @@ -0,0 +1,17 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8" isErrorPage="true"%> | |
3 | +<!DOCTYPE html> | |
4 | +<html> | |
5 | +<head> | |
6 | +<meta charset="UTF-8"> | |
7 | +<title>Sorry Error</title> | |
8 | +</head> | |
9 | +<body> | |
10 | + <h2>error!!</h2> | |
11 | + <hr /> | |
12 | + Call Web master please <br /> | |
13 | + It will be fix soon! | |
14 | + <hr /> | |
15 | + <%= exception %> | |
16 | +</body> | |
17 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/error_test.jsp
... | ... | @@ -0,0 +1,16 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8" errorPage="error.jsp"%> | |
3 | +<!DOCTYPE html> | |
4 | +<html> | |
5 | +<head> | |
6 | +<meta charset="UTF-8"> | |
7 | +<title>Insert title here</title> | |
8 | +</head> | |
9 | +<body> | |
10 | + <h2>This is error test Page</h2> | |
11 | + <% | |
12 | + String a = "test"; | |
13 | + int i = Integer.parseInt(a); | |
14 | + %> | |
15 | +</body> | |
16 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/include_test.jsp
... | ... | @@ -0,0 +1,19 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | +<!DOCTYPE html> | |
4 | +<html> | |
5 | +<head> | |
6 | +<meta charset="UTF-8"> | |
7 | +<title>Main Page</title> | |
8 | +</head> | |
9 | +<body> | |
10 | + <h2>This is main page</h2> | |
11 | + <hr> | |
12 | + <h2>News Page</h2> | |
13 | + <%@ include file="news.jsp" %> | |
14 | + <hr /> | |
15 | + <h2>Shopping Page</h2> | |
16 | + <%@ include file="shopping.jsp" %> | |
17 | + <h2>End main page</h2> | |
18 | +</body> | |
19 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/index.jsp
... | ... | @@ -0,0 +1,49 @@ |
1 | +<!doctype html> | |
2 | +<html lang="ko"> | |
3 | +<head> | |
4 | + <meta charset="UTF-8"> | |
5 | + <style> | |
6 | + * {margin: 0; padding: 0; box-sizing: border-box; color: #666666;} | |
7 | + body {background: no-repeat url("http://web.miri.kr/example/images/bg.jpg")fixed; background-size: cover;} | |
8 | + #container {width: 1030px; margin: 0 auto;background-color: white} | |
9 | + #top {background-color: #666666;} | |
10 | + #top ul li {display: inline-block; vertical-align: middle; margin-right: 40px;} | |
11 | + #top ul li a {text-decoration: none; color: white; font-weight: 600; font-size: large;} | |
12 | + #top ul li a:hover {color: black;} | |
13 | + #second {background: url("http://web.miri.kr/example/images/main1.jpg"); width: 1030px; height: 500px;} | |
14 | + #article {width: 1030px; height: 500px;} | |
15 | + #left {width: 70%; height: 500px; float: left;} | |
16 | + #right {width: 30%; height: 500px; float: left;} | |
17 | + #leftTop {height: 50%;} | |
18 | + #leftBottom {height: 50%;} | |
19 | + #leftTopLeft {width: 50%; height: 100%; float: left;} | |
20 | + #leftTopRight {width: 50%; height: 100%; float: left;} | |
21 | + #leftBottomLeft {width: 50%; height: 100%; float: left;} | |
22 | + #leftBottomRight {width: 50%; height: 100%; float: left;} | |
23 | + #img2 {width: 300px; height: 210px; margin-left: 25px; margin-top: 15px;} | |
24 | + #lorem1 {font-size: 25px;} | |
25 | + #lorem2 {font-size: 20px; color: #985d6a;} | |
26 | + #caption1 {margin-left: 25px;} | |
27 | + #this {margin-left: 10px; margin-top: 20px;} | |
28 | + #img3 {width: 300px; height: 210px; margin-left: 25px; margin-top: 15px;} | |
29 | + #rightTop {width: 100%; height: 50%;} | |
30 | + #rightBottom {width: 100%; height: 50%;} | |
31 | + #rightTop ul {margin-top: 10px;} | |
32 | + #rightTop ul li {list-style: none; margin-bottom: 20px;} | |
33 | + #rightTop ul li:hover {background-color: #aeaca8;} | |
34 | + #rightTop ul li a {text-decoration: none; color: #985d6a;} | |
35 | + #walking {font-size: 30px;} | |
36 | + #this0 {margin-top: 10px;} | |
37 | + #contact {font-size: 30px; color: #985d6a;} | |
38 | + #footer {background-color: #666666; color: white; padding: 10px 0 10px 5px;} | |
39 | + </style> | |
40 | +</head> | |
41 | +<body> | |
42 | + <div id="container"> | |
43 | + <!-- 스크립트릿 --> | |
44 | + <%@ include file="top.jsp" %> | |
45 | + <%@ include file="article.jsp" %> | |
46 | + <%@ include file="footer.jsp" %> | |
47 | + </div> | |
48 | +</body> | |
49 | +</html>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/news.jsp
... | ... | @@ -0,0 +1,4 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | + | |
4 | + [게임] [쇼핑] [시사](No newline at end of file) |
+++ 202108/src/main/webapp/0812/shopping.jsp
... | ... | @@ -0,0 +1,9 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | + | |
4 | + <ul> | |
5 | + <li>상의</li> | |
6 | + <li>하의</li> | |
7 | + <li>아우터</li> | |
8 | + <li>악세사리</li> | |
9 | + </ul>(No newline at end of file) |
+++ 202108/src/main/webapp/0812/top.jsp
... | ... | @@ -0,0 +1,12 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | + <div id="top"> | |
4 | + <ul> | |
5 | + <li><a href="#"><img id="logo" src="http://www.aiit.or.kr/images/logo.png"></a></li> | |
6 | + <li><a href="#">Company</a></li> | |
7 | + <li><a href="#">Product</a></li> | |
8 | + <li><a href="#">Service</a></li> | |
9 | + <li><a href="#">Community</a></li> | |
10 | + <li><a href="#">Contact</a></li> | |
11 | + </ul> | |
12 | + </div>(No newline at end of file) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?