---
title: "Servlet生命周期、请求转发、与sendRedirect区别"
author: "xuxujing"
date: "2014-06-19T10:40:15Z"
tags: []
categories: ["行业应用"]
slug: "servlet-sendredirect"
draft: false
lastmod: "2014-06-19T10:43:16Z"
id: 2082439
url: "https://xujava.iteye.com/blog/2082439"
---

来自JavaWeb开发详解，方便查看：

生命周期：

![](http://dl2.iteye.com/upload/attachment/0098/2470/442f0492-ac0c-394b-ac40-0335179512b5.gif)  
 

 

请求转发：  
![](http://dl2.iteye.com/upload/attachment/0098/2472/43fda6c2-855b-358a-8a0a-2c4ae60361de.gif)  
 

 

sendRedirect:  
![](http://dl2.iteye.com/upload/attachment/0098/2474/62df3c0c-b356-3b25-8773-96c22f5183d3.gif)  
 

转发：

![](http://dl2.iteye.com/upload/attachment/0098/2476/7f4f05d5-9d7c-3198-af69-c9458a467537.gif)  
 请求转发代码：

![](http://dl2.iteye.com/upload/attachment/0098/2478/b899bcaf-3fa0-3ce5-bfb9-dee4395556e0.gif)  
 

![](http://dl2.iteye.com/upload/attachment/0098/2480/4998707d-e514-3188-9d3f-ab4252efb833.gif)