240102 웹 만들기 ; Test.java
2024. 1. 4. 16:07ㆍ2023.11.21-2024.05.31
웹 만들기 ;
(자바스크립트+CSS+HTML)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package com.sukgi.web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/test")
public class Test extends HttpServlet {
private static final long serialVersionUID = 1L;
public Test() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//response.getWriter().append("Served at: ").append(request.getContextPath());
response.setContentType("text/html;charset=UTF-8");
PrintWriter pw = response.getWriter();
pw.println("<html>");
pw.println("<head>");
pw.println("<title>타이틀입니다</title>");
pw.println("</head>");
pw.println("<body>");
pw.println("<h1>서블릿이 호출되었습니다.</h1>");
pw.println("이렇게 작업해야 해요. 너무 힘들어요.");
pw.println("수정하려면 다시 컴파일 해서 실행해야 해요.");
pw.println("이것보다 jsp가 조금 더 편합니다. 아니 더 편해요.");
pw.println("</body>");
pw.println("</html>");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
/*
*
* request
* response
* get방식
*
*
*
* post방식
*
* */
|
cs |
'2023.11.21-2024.05.31' 카테고리의 다른 글
240102 웹 만들기 ; Write.java (1) | 2024.01.04 |
---|---|
240102 HTML Update.java (1) | 2024.01.04 |
240102 HTML Study.java (1) | 2024.01.04 |
240102 HTML Delete.java (1) | 2024.01.04 |
240102 HTML DBConnection.java (1) | 2024.01.04 |