For <jsp:forward> and Response.sendredirect () These two jumps, the confidence everybody certainly will not be unfamiliar,<jsp:forward> belong to jump of an instruction, Response.sendredirect () is a jump method in the response object, more specifically, a turn. But in any case, both can be implemented by one page jump to another page of the jump function. So what's the difference between the two? Or do you want to use any of them? Let's take a look at it together:
To understand the difference, for example, the most intuitive, look at the following example:
We want to do two pages:
A jump page "turn_01.jsp (with <jsp:forward>), turn_02.jsp (with Response.sendredirect ())"
A page after the jump (turnafter.html).
turnafter.html
turn_01.jsp
<%@ page language= "java" contenttype= "text/html" pageencoding= "GBK"%>
Run, look at the results of the browser, is really a jump, but the address bar has not changed, more interesting is to look at the results of the server, as shown in the following figure:
According to the results shown, only jumps before, and no jumps after. Let's take a look at another way to jump.
turn_02.jsp
<%@ page language= "java" contenttype= "text/html" pageencoding= "GBK"%>