Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Java
- rinux
- 오라클
- 자바
- 정처기필기
- 원형그래프
- 참조타입
- sql
- Oracle
- 네트워크
- html
- 네트워크관리사
- php
- jsp
- autoset
- javaee
- ospf
- 이것이 자바다
- w3school
- ciscopacket
- 리눅스
- NCS
- 버추얼머신
- 정보처리기사
- cisco packet
- jsp연결
- Cisco
- 라우터
- 데이터베이스
- VLAN
Archives
- Today
- Total
기록해! 정리해!
Spring - 서블릿 클래스 확인 본문
교재 42p
[ web.xml ]
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://Java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<servlet>
<description></description>
<servlet-name>SchoolController</servlet-name>
<servlet-class>com.springbook.biz.controller.SchoolController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SchoolController</servlet-name>
<url-pattern>/SchoolController.do</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<servlet-name>BoardController</servlet-name>
<servlet-class>com.springbook.biz.controller.BoardController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BoardController</servlet-name>
<url-pattern>/BoardController.to</url-pattern>
</servlet-mapping>
</web-app>
[ index.jsp ]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div align="center">
<br><br><br>
<h1>
<a href=SchoolController.do> Spring 연습1</a>
</h1>
<h1>
<a href=BoardController.to> Spring 연습2</a>
</h1>
</div>
</body>
</html>
package com.springbook.biz.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class BoardController
*/
public class BoardController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public BoardController() {
super();
// TODO Auto-generated constructor stub
System.out.println("==> BoardController 생성자");
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
// response.getWriter().append("Served at: ").append(request.getContextPath());
System.out.println("==> BoardController 의 doGet메소드 ");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
'Spring' 카테고리의 다른 글
Setter 사용하기 (2) - p 네임스페이스 사용하기 (0) | 2022.09.20 |
---|---|
Setter 사용하기 (1) (0) | 2022.09.20 |
ajax + jQuery + 댓글 (0) | 2022.09.19 |
MyBatis (0) | 2022.09.08 |
Spring - lombok (0) | 2022.08.26 |
Comments