Some code has been commented out because it has an impact on other code during local debugging.
1. Redirection/Refers to 127.0.0.1,
If not, add the specified Page name from akazamtest01.
There cannot be two response. sendredirect ("")
If the HTTP path is added, it will jump directly to the domain name
After redirection, the following code will be executed and may be flashed.
Test method: jump to a foreign website and display the redirected content on the page after loading for a long time.
2. Switch/Refers to 127.0.0.1/akazamtest01
The following code will not be executed after turning
Forward transmits parameters to the next page through JSP: Param
<Body>
1. Redirection/Refers to 127.0.0.1,
If not, add the specified Page name from akazamtest01.
There cannot be two response. sendredirect ("")
If the HTTP path is added, it will jump directly to the domain name
After redirection, the following code will be executed and may be flashed.
Test method: jump to a foreign website and display the redirected content on the page after loading for a long time.
2. Switch/Refers to 127.0.0.1/akazamtest01
The following code will not be executed after turning
Forward transmits parameters to the next page through JSP: Param
<%
// Response. sendredirect ("Logon. jsp? B = 1 ");
// Response. sendredirect ("http://www.baidu.com ");
%>
<% Int I = 9; request. setattribute ("name", "akazam"); %> -- the value must be written here.
<JSP: Forward page = "bean/index. jsp? Method = forward ">
<JSP: Param value = "$ {name}" name = "name"/>
<JSP: Param value = "2" name = "name1"/>
<% Int I = 9; request. setattribute ("name", "akazam"); %> JAVA code cannot be written here
<JSP: Param value = "<% = I %>" name = "name2"/>
</Jsp: Forward>
</Body>
Otherwise, the following error occurs:
The above code uploads Parameters
The parameters are retrieved as follows:
<Body>
Parameters after the address is retrieved: <br/>
$ {Param. Method} <br/>
I passed it from index JSP in the root directory <br/>
This is obtained using Java code <br/>
<% = Request. getparameter ("name") %>
Equivalent to: <% Out. print (request. getparameter ("method"); %> the difference is that <B> <font color = "red" >;</font> </B> must be written here.
<Br/>
This is obtained using the El expression. <br/>
$ {Param. name}
<Br/>
Two Methods: print the value on the page
<% Int I = 0; %> -- local variable of the Method
<% Out. Print (++ I); %> <br/>
This is generally not easy to use.
<%! Int J = 0; %> -- the member variable declared as servlet, which is a global variable. Multiple Clients share one copy.
<% = ++ J %>
</Body>
Run: