--- Servers/Tomcat v9.0 Server at localhost-config/server.xml
+++ Servers/Tomcat v9.0 Server at localhost-config/server.xml
... | ... | @@ -153,7 +153,7 @@ |
153 | 153 |
Note: The pattern used is equivalent to using pattern="common" --> |
154 | 154 |
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/> |
155 | 155 |
|
156 |
- <Context docBase="202108" path="/202108" reloadable="true" source="org.eclipse.jst.jee.server:202108"/></Host> |
|
156 |
+ <Context docBase="WebTest" path="/WebTest" reloadable="true" source="org.eclipse.jst.jee.server:WebTest"/></Host> |
|
157 | 157 |
</Engine> |
158 | 158 |
</Service> |
159 | 159 |
</Server>(No newline at end of file) |
+++ WebTest/.classpath
... | ... | @@ -0,0 +1,13 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<classpath> | |
3 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | |
4 | + <classpathentry kind="src" path="src/main/java"/> | |
5 | + <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0"> | |
6 | + <attributes> | |
7 | + <attribute name="owner.project.facets" value="jst.web"/> | |
8 | + </attributes> | |
9 | + </classpathentry> | |
10 | + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> | |
11 | + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> | |
12 | + <classpathentry kind="output" path="build/classes"/> | |
13 | +</classpath> |
+++ WebTest/.gitignore
... | ... | @@ -0,0 +1,1 @@ |
1 | +/build/ |
+++ WebTest/.project
... | ... | @@ -0,0 +1,31 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>WebTest</name> | |
4 | + <comment></comment> | |
5 | + <projects> | |
6 | + </projects> | |
7 | + <buildSpec> | |
8 | + <buildCommand> | |
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | |
10 | + <arguments> | |
11 | + </arguments> | |
12 | + </buildCommand> | |
13 | + <buildCommand> | |
14 | + <name>org.eclipse.wst.common.project.facet.core.builder</name> | |
15 | + <arguments> | |
16 | + </arguments> | |
17 | + </buildCommand> | |
18 | + <buildCommand> | |
19 | + <name>org.eclipse.wst.validation.validationbuilder</name> | |
20 | + <arguments> | |
21 | + </arguments> | |
22 | + </buildCommand> | |
23 | + </buildSpec> | |
24 | + <natures> | |
25 | + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | |
26 | + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | |
27 | + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> | |
28 | + <nature>org.eclipse.jdt.core.javanature</nature> | |
29 | + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> | |
30 | + </natures> | |
31 | +</projectDescription> |
+++ WebTest/.settings/.jsdtscope
... | ... | @@ -0,0 +1,12 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<classpath> | |
3 | + <classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/> | |
4 | + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> | |
5 | + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> | |
6 | + <attributes> | |
7 | + <attribute name="hide" value="true"/> | |
8 | + </attributes> | |
9 | + </classpathentry> | |
10 | + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> | |
11 | + <classpathentry kind="output" path=""/> | |
12 | +</classpath> |
+++ WebTest/.settings/org.eclipse.jdt.core.prefs
... | ... | @@ -0,0 +1,7 @@ |
1 | +eclipse.preferences.version=1 | |
2 | +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |
3 | +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | |
4 | +org.eclipse.jdt.core.compiler.compliance=1.8 | |
5 | +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |
6 | +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |
7 | +org.eclipse.jdt.core.compiler.source=1.8 |
+++ WebTest/.settings/org.eclipse.wst.common.component
... | ... | @@ -0,0 +1,14 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> | |
2 | + | |
3 | + <wb-module deploy-name="WebTest"> | |
4 | + | |
5 | + <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> | |
6 | + | |
7 | + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> | |
8 | + | |
9 | + <property name="java-output-path" value="/WebTest/build/classes"/> | |
10 | + <property name="context-root" value="WebTest"/> | |
11 | + | |
12 | + </wb-module> | |
13 | + | |
14 | +</project-modules> |
+++ WebTest/.settings/org.eclipse.wst.common.project.facet.core.xml
... | ... | @@ -0,0 +1,10 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<faceted-project> | |
3 | + <runtime name="Apache Tomcat v9.0"/> | |
4 | + <fixed facet="wst.jsdt.web"/> | |
5 | + <fixed facet="java"/> | |
6 | + <fixed facet="jst.web"/> | |
7 | + <installed facet="java" version="1.8"/> | |
8 | + <installed facet="jst.web" version="3.1"/> | |
9 | + <installed facet="wst.jsdt.web" version="1.0"/> | |
10 | +</faceted-project> |
+++ WebTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
... | ... | @@ -0,0 +1,1 @@ |
1 | +org.eclipse.wst.jsdt.launching.baseBrowserLibrary(No newline at end of file) |
+++ WebTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
... | ... | @@ -0,0 +1,1 @@ |
1 | +Window(No newline at end of file) |
+++ WebTest/src/main/java/servlet/Main.java
... | ... | @@ -0,0 +1,57 @@ |
1 | +package servlet; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.io.PrintWriter; | |
5 | + | |
6 | +import javax.servlet.ServletException; | |
7 | +import javax.servlet.annotation.WebServlet; | |
8 | +import javax.servlet.http.HttpServlet; | |
9 | +import javax.servlet.http.HttpServletRequest; | |
10 | +import javax.servlet.http.HttpServletResponse; | |
11 | + | |
12 | +/** | |
13 | + * Servlet implementation class Main | |
14 | + */ | |
15 | +//@WebServlet("/Main") | |
16 | +public class Main extends HttpServlet { | |
17 | + private static final long serialVersionUID = 1L; | |
18 | + | |
19 | + /** | |
20 | + * @see HttpServlet#HttpServlet() | |
21 | + */ | |
22 | + public Main() { | |
23 | + super(); | |
24 | + // TODO Auto-generated constructor stub | |
25 | + } | |
26 | + | |
27 | + /** | |
28 | + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) | |
29 | + */ | |
30 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
31 | + | |
32 | + request.setCharacterEncoding("UTF-8"); | |
33 | + response.setCharacterEncoding("UTF-8"); | |
34 | + response.setContentType("text/html; charset=utf-8"); | |
35 | + | |
36 | + PrintWriter out = response.getWriter(); | |
37 | + out.println("<html lang='ko'>"); | |
38 | + out.println("<head>"); | |
39 | + out.println("<meta charset='UTF-8'>"); | |
40 | + out.println("<title>Main Page</title>"); | |
41 | + out.println("</head>"); | |
42 | + out.println("<body>"); | |
43 | + out.println("<h3>This is Main Page</h3>"); | |
44 | + out.println("</body>"); | |
45 | + out.println("</html>"); | |
46 | + | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) | |
51 | + */ | |
52 | + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
53 | + // TODO Auto-generated method stub | |
54 | + doGet(request, response); | |
55 | + } | |
56 | + | |
57 | +} |
+++ WebTest/src/main/java/servlet/MyServlet.java
... | ... | @@ -0,0 +1,58 @@ |
1 | +package servlet; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.io.PrintWriter; | |
5 | + | |
6 | +import javax.servlet.ServletException; | |
7 | +import javax.servlet.annotation.WebServlet; | |
8 | +import javax.servlet.http.HttpServlet; | |
9 | +import javax.servlet.http.HttpServletRequest; | |
10 | +import javax.servlet.http.HttpServletResponse; | |
11 | + | |
12 | +/** | |
13 | + * Servlet implementation class MyServlet | |
14 | + */ | |
15 | +@WebServlet("/MyServlet") | |
16 | +public class MyServlet extends HttpServlet { | |
17 | + private static final long serialVersionUID = 1L; | |
18 | + | |
19 | + /** | |
20 | + * @see HttpServlet#HttpServlet() | |
21 | + */ | |
22 | + public MyServlet() { | |
23 | + super(); | |
24 | + // TODO Auto-generated constructor stub | |
25 | + } | |
26 | + | |
27 | + /** | |
28 | + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) | |
29 | + */ | |
30 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
31 | + | |
32 | + request.setCharacterEncoding("UTF-8"); //post method korean | |
33 | + response.setCharacterEncoding("UTF-8"); //get method korean | |
34 | + response.setContentType("text/html; charset=utf-8"); //html contents korean | |
35 | + | |
36 | +// response.getWriter().append("Served at: ").append(request.getContextPath()); | |
37 | + PrintWriter out = response.getWriter(); | |
38 | + out.println("<html lang='ko'>"); | |
39 | + out.println("<head>"); | |
40 | + out.println("<meta charset='UTF-8'>"); | |
41 | + out.println("<title>Servlet Test</title>"); | |
42 | + out.println("</head>"); | |
43 | + out.println("<body>"); | |
44 | + out.println("<h3>MyServlet Test</h3>"); | |
45 | + out.println("</body>"); | |
46 | + out.println("</html>"); | |
47 | + | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) | |
52 | + */ | |
53 | + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
54 | + // TODO Auto-generated method stub | |
55 | + doGet(request, response); | |
56 | + } | |
57 | + | |
58 | +} |
+++ WebTest/src/main/webapp/META-INF/MANIFEST.MF
... | ... | @@ -0,0 +1,3 @@ |
1 | +Manifest-Version: 1.0 | |
2 | +Class-Path: | |
3 | + |
+++ WebTest/src/main/webapp/WEB-INF/web.xml
... | ... | @@ -0,0 +1,46 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> | |
3 | + <display-name>WebTest</display-name> | |
4 | + <welcome-file-list> | |
5 | + <welcome-file>index.html</welcome-file> | |
6 | + <welcome-file>index.htm</welcome-file> | |
7 | + <welcome-file>index.jsp</welcome-file> | |
8 | + <welcome-file>default.html</welcome-file> | |
9 | + <welcome-file>default.htm</welcome-file> | |
10 | + <welcome-file>default.jsp</welcome-file> | |
11 | + </welcome-file-list> | |
12 | + <servlet> | |
13 | + <servlet-name>main</servlet-name> | |
14 | + <servlet-class>servlet.Main</servlet-class> | |
15 | + </servlet> | |
16 | + | |
17 | + <servlet> | |
18 | + <servlet-name>testpage</servlet-name> | |
19 | + <jsp-file>/test.jsp</jsp-file> | |
20 | + <init-param> | |
21 | + <param-name>name</param-name> | |
22 | + <param-value>홍길동</param-value> | |
23 | + </init-param> | |
24 | + </servlet> | |
25 | + | |
26 | + <servlet> | |
27 | + <servlet-name>testpage2</servlet-name> | |
28 | + <jsp-file>/test2.jsp</jsp-file> | |
29 | + </servlet> | |
30 | + | |
31 | + <servlet-mapping> | |
32 | + <servlet-name>main</servlet-name> | |
33 | + <url-pattern>/main</url-pattern> | |
34 | + </servlet-mapping> | |
35 | + | |
36 | + <servlet-mapping> | |
37 | + <servlet-name>testpage</servlet-name> | |
38 | + <url-pattern>/test</url-pattern> | |
39 | + </servlet-mapping> | |
40 | + | |
41 | + <servlet-mapping> | |
42 | + <servlet-name>testpage2</servlet-name> | |
43 | + <url-pattern>/test2</url-pattern> | |
44 | + </servlet-mapping> | |
45 | + | |
46 | +</web-app> |
+++ WebTest/src/main/webapp/test.jsp
... | ... | @@ -0,0 +1,22 @@ |
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" | |
2 | + pageEncoding="UTF-8"%> | |
3 | +<%! | |
4 | + String title = "광주대"; | |
5 | +%> | |
6 | +<% | |
7 | + String title2 = "융합소프트"; | |
8 | +%> | |
9 | +<!DOCTYPE html> | |
10 | +<html lang="ko"> | |
11 | +<head> | |
12 | +<meta charset="UTF-8"> | |
13 | +<title>Insert title here</title> | |
14 | +</head> | |
15 | +<body> | |
16 | + <h3><%=title %></h3> | |
17 | + <h4><%=title2 %></h4> | |
18 | + <p> | |
19 | + <%=getInitParameter("name") %> | |
20 | + </p> | |
21 | +</body> | |
22 | +</html>(No newline at end of file) |
+++ WebTest/src/main/webapp/test2.jsp
... | ... | @@ -0,0 +1,12 @@ |
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>Insert title here</title> | |
8 | +</head> | |
9 | +<body> | |
10 | + <%=getInitParameter("name") %> | |
11 | +</body> | |
12 | +</html>(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?