1. HTTP (Hyper Text Transfer Protocol):
인터넷에서 하이퍼 텍스트 문서를 교환하기 위해 사용되는 프로토콜
2. FTP (File Transfer Protocol):
컴퓨터 사이의 원활한 파일 전송을 위해 사용되는 프로토콜
3. SMTP (Simple Mail Transfer Protocol):
사용자의 컴퓨터에서 작성된 메일을 받아서 다른 사람의 계정이 있는 곳으로 전송해주는 전자 우편 송신 프로토콜
컴퓨터의 IP를 찾아 들어간다. (여기서는 localhost)
Tomcat이(웹 애플리케이션 서버)가 관리하는 프로그램 번호 8282를 찾아가서 jsp_hello패키지의 hello.jsp 파일을 찾음
hello.jsp 파일을 hello_jsp.java 파일로 변환한 후 컴파일하여 hello_jsp.class 파일을 생성한다.
.class 파일을 전달한다.
크롬 개발자 도구에서 실행된 내용을 살펴보면 html 부분만 보이는데 이것은 Servlet 때문이다.
Web Server (= HTTP Server)
클라이언트(browser)의 요청(request)에 의해 정보를 제공(response)해 주는 서버
HTTP 프로토콜을 사용해 클라이언트와 통신합니다. (HTTP는 클라이언트-웹서버간 문서를 전송하기 위한 통신 규약)
정적인 정보를 처리하며(Static processe), 동적 처리(Dynamic processe)는 웹 어플리케이션 서버(WAS)에 요청합니다.
대표적으로는 Aphach HTTP Server, Microsoft IIS, Nginx 가 있습니다.
WAS (Web Application Server)
→ 일반적으로 웹 서버의 기능을 내제하고 있어 웹 서버 없이도 서비스가 가능합니다.
→ 웹 서버의 성능을 개선하기 위해 기능을 분리한 것
→ 모든 클라이언트의 요청에 대해 매번 프로세스를 생성하지 않고 하나의 자바 가상 기계 내에서 수행합니다.
Port Number (포트 번호)
Port 번호는 찾아간 IP주소에서 실행 하려는 프로그램 번호
데이터를 받을 프로세스(process)가 어떤 것인지 알기 위해 사용하는 식별자
= 웹 애플리케이션 서버가 관리하는 경로
총점 : 270
평균 : 90


--모든 사원의 이름,직업,부서이름,급여 및 등급을 출력하라.
select ename,job,dname,sal,grade from emp, dept, salgrade where emp.deptno=dept.deptno and emp.sal between salgrade.losal and salgrade.hisal;
DALLAS에서 근무하는 모든 사원의 이름, 직업, 부서번호 및 부서이름을 출력하라.
select ename,dname,job,emp.deptno from emp,dept where emp.deptno=dept.deptno and loc ='DALLAS';
커미션이 책정되어 있는 모든 사원의 이름, 부서이름 및 위치를 출력하라.
select ename, dname, loc from emp,dept where emp.deptno=dept.deptno and comm is not null;
각사원과 각사원의 메니져 이름이 나오도록 하시오.
select e.ename||'의 매니저는'|| m.ename||'입니다' from emp e, emp m where e.mgr=m.empno;
부서번호가 10번인 사원들의 이름, 근무지 및 sal 출력
select ename,loc,sal from emp, dept where dept.deptno=emp.deptno and emp.deptno='10';
이름이 CLERK인 사람의 부서명과 근무지를 출력하시오.
select ename, loc , emp.deptno from emp, dept where dept.deptno=emp.deptno and emp.ename ='CLARK';
(아래 코딩은 mapping과 do Get()메소드만 표시했습니다)
-sevlet_example 프로젝트 생성
-/hello 로 치고 들어오면 Hello 를 출력하는 HelloWorld.java 서블릿 파일 작성

@WebServlet("/hello")
public class HelloWorld extends HttpServlet {
.....
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out=response.getWriter();
out.print("<html>");
out.print("<body>");
out.print("<h1>hello</h1>");
out.print("</body>");
out.close();
}
-/lotto 로 치고 들어오면 로또번호 6개를 출력하는 LottoNum.java 서블릿 파일 작성

@WebServlet("/lotto")
public class LottoNum extends HttpServlet {
.....
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
Set<Integer> Lotto = new HashSet<>();
final int COUNT = 6;
while (Lotto.size() < COUNT) {
Lotto.add((int) (Math.random() * 45 + 1));
}
out.print("<html>");
out.print("<body>");
out.print(Lotto);
out.print("</body>");
out.print("</html>");
out.close();
}
-/gugu3 으로 치고 들어오면 구구단 3단을 출력하는 GuGu3Dan.java 서블릿 파일 작성

@WebServlet("/gugu3")
public class GuGu3Dan extends HttpServlet {
.....
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out=response.getWriter();
out.print("<html>");
out.print("<body>");
out.print("3단 <br>");
for (int i = 1; i < 10; i++) {
out.print(3 + "x" + i+ "=" + 3 *i +"<br>");
}
out.print("</body>");
out.close();
}
-/gugudan 으로 치고 들어오면 구구단(1단~9단)을 출력하는 GuGuDan.java 서블릿 파일 작성

@WebServlet("/gugudan")
public class GuGuDan extends HttpServlet {
.....
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.print("<html>");
out.print("<body>");
for (int i = 1; i < 10; i++) {
out.print(i + "단을 출력합니다."+ "<br>");
for (int j = 1; j < 10; j++) {
out.print(i + "x" + j + "=" + i * j + "<br>");
}
}
out.print("</body>");
out.close();
}