일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- websocket
- JSP
- 웹게임
- AWS
- Servlet
- Ajax
- jQuery
- autowired
- HTML
- phaser
- 블록체인
- Spring
- 도커
- 웹소켓
- SQL
- 비트코인
- RDS
- PL/SQL
- EC2
- Cookie
- model1
- express
- 알고리즘
- node.js
- 배포
- tiles.xml
- CSS
- 암호화
- docker
- JavaScript
- Today
- Total
記錄
Servlet) 기본 흐름, web.xml 매핑 본문
web.xml을 통한 매핑
먼저 이름과 경로를 설정해주고 매핑(mapping) 단계에서 '지정해 주는 url'을 '이름'으로 가도록 설정한다.
여기서는 /java/study/~ 의 모든 파일(심지어 존재하지 않는 주소라 해도) 결국 path로 가게 된다.
Servlet 기본적 사항
javax.servlet
Interface RequestDispatcher
public interface RequestDispatcher
Defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server. The servlet container creates the RequestDispatcher object, which is used as a wrapper around a server resource located at a particular path or given by a particular name.
This interface is intended to wrap servlets, but a servlet container can create RequestDispatcher objects to wrap any type of resource.
forward
public void forward (ServletRequest request, ServletResponse response)
throws ServletException, java.io.IOException
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate the response.
For a RequestDispatcher obtained via getRequestDispatcher(), the ServletRequest object has its path elements and parameters adjusted to match the path of the target resource.
forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.
The request and response parameters must be either the same objects as were passed to the calling servlet's service method or be subclasses of the ServletRequestWrapper or ServletResponseWrapper classes that wrap them.
Parameters:
request - a ServletRequest object that represents the request the client makes of the servlet
response - a ServletResponse object that represents the response the servlet returns to the client
'Web > Servlet' 카테고리의 다른 글
Servlet) 커넥션 풀(DBCP) (0) | 2018.03.29 |
---|---|
Servlet) 예제(단순 알림 or 객체 전달) (0) | 2018.03.29 |
Servlet) out.print()에 대한 이해 (0) | 2018.03.29 |
Servlet) Life Cycle, @WebServlet 설정 (0) | 2018.03.29 |
Servlet) 키워드 받아서 경로 나눠주는 방식(cmd) (0) | 2018.03.28 |