728x90
index (client)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!--
server + applet = Servlet
client server DB
----- > Servar container
request์์ฒญ
http
web.xml
< ------
responce์๋ต ๋์ ๋ฐฉ์(GET POST)
-->
<h1>servlet ๊ธฐ๋ณธ</h1>
<form action="location" method = "get">
<input type = "submit" value = "GET๋ฐฉ์">
</form>
<form action="location" method = "post">
<input type = "submit" value = "Post๋ฐฉ์">
</form>
</body>
</html>
xml์ sevlet ์ง์
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>helloServlet</servlet-name>
<servlet-class>sample01.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloServlet</servlet-name>
<url-pattern>/location</url-pattern>
</servlet-mapping>
</web-app>
HelloServlet
package sample01;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("HelloServlet doGet");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("HelloServlet doPost");
}
}
'๐ ์๋ฐ ์๋ฒ ํ์ด์ง JSP > ๐ ์น \ ์๋ธ๋ฆฟ Web , Servlet' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Web - Servlet ์ค์ต 4 (form -> ์๋ฒ -> html ์ถ๋ ฅ) (0) | 2021.03.15 |
---|---|
Web - Servlet ์ค์ต 3 (์ํ์ฝ๋ , html ์ฝ๋๋ฅผ ๋ฐ์ ์๋ฒ์์ ํ์ธํ ์ถ๋ ฅ) (0) | 2021.03.14 |
Web - Servlet ์ค์ต 2 (ํด๋ผ์ด์ธํธ ๋ฐ์ดํฐ -> ์๋ฒ๋ก ๋๊ฒจ์ฃผ๊ธฐ) (0) | 2021.03.14 |
Web - 1๏ธโฃ Servlet์ด๋ (0) | 2021.03.14 |
Web Server์ ๋ํด (0) | 2021.03.14 |
๋๊ธ