안효원 안효원 2021-08-12
JSPDay1End
@34025382c72f1d7a6584261fc17a00dde094ac8a
 
202108/src/main/webapp/calc.html (added)
+++ 202108/src/main/webapp/calc.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Calculator</title>
+</head>
+<body>
+	<form action="calc.jsp" method="post">
+		<input type="text" name="num1">
+		<select name="op">
+			<option value="+">+</option>
+			<option value="-">-</option>
+			<option value="*">*</option>
+			<option value="/">/</option>
+		</select>
+		<input type="text" name="num2">
+		<input type="submit" value="Run">
+	</form>
+</body>
+</html>(No newline at end of file)
 
202108/src/main/webapp/calc.jsp (added)
+++ 202108/src/main/webapp/calc.jsp
@@ -0,0 +1,32 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+<%
+	String num1 = request.getParameter("num1");
+	String op = request.getParameter("op");
+	String num2 = request.getParameter("num2");
+%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Calculating Result</title>
+</head>
+<body>
+	<%
+		int result = 0;
+		if(op.equals("+")){
+			result = Integer.parseInt(num1) + Integer.parseInt(num2);
+		}
+		else if(op.equals("-")){
+			result = Integer.parseInt(num1) - Integer.parseInt(num2);
+		}
+		else if(op.equals("*")){
+			result = Integer.parseInt(num1) * Integer.parseInt(num2);
+		}
+		else {
+			result = Integer.parseInt(num1) / Integer.parseInt(num2);
+		}
+		out.print("계산 결과 = " + result);
+	%>
+</body>
+</html>(No newline at end of file)
 
202108/src/main/webapp/check.jsp (added)
+++ 202108/src/main/webapp/check.jsp
@@ -0,0 +1,18 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+<%
+	String id = request.getParameter("id");
+	String pw = request.getParameter("pw");
+	out.print(id);
+	out.print(pw);
+%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Login Check</title>
+</head>
+<body>
+
+</body>
+</html>(No newline at end of file)
 
202108/src/main/webapp/login.html (added)
+++ 202108/src/main/webapp/login.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Login Page</title>
+</head>
+<body>
+	<form action="check.jsp" method="post">
+		ID : <input type="text" name="id"><br><br>
+		P/W : <input type="password" name="pw">
+		<input type="submit" value="Login">
+	</form>
+</body>
+</html>(No newline at end of file)
 
202108/src/main/webapp/test.jsp (added)
+++ 202108/src/main/webapp/test.jsp
@@ -0,0 +1,24 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+	pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="EUC-KR">
+<title>Insert title here</title>
+<style>
+	#container {background-color: grey; color: white;}
+</style>
+</head>
+<body>
+	<div id="container">
+		오늘 날자와 시간은 <%=new java.util.Date() %>입니다.
+		<%
+			int a = 1;
+			int b = 2;
+			int c = a+b;
+		%>
+		<br>
+		자바로 계산한 결과는 = <%=c %>
+	</div>
+</body>
+</html>(No newline at end of file)
Servers/Tomcat v9.0 Server at localhost-config/server.xml
--- Servers/Tomcat v9.0 Server at localhost-config/server.xml
+++ Servers/Tomcat v9.0 Server at localhost-config/server.xml
@@ -60,7 +60,7 @@
          APR (HTTP/AJP) Connector: /docs/apr.html
          Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
     -->
-    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
+    <Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8443"/>
     <!-- A "Connector" using the shared thread pool-->
     <!--
     <Connector executor="tomcatThreadPool"
@@ -153,7 +153,7 @@
              Note: The pattern used is equivalent to using pattern="common" -->
         <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>
 
-      </Host>
+      <Context docBase="202108" path="/202108" reloadable="true" source="org.eclipse.jst.jee.server:202108"/></Host>
     </Engine>
   </Service>
 </Server>
(No newline at end of file)
Add a comment
List