Response.sendRedirect's considerations
First we have to understand the principle of turning with response.sendredirect, it is actually sending a special header to the browser, then makes the browser to turn to the specified page, so use Sendredirect, on the address bar of the browser You can see the change in the address.
Unlike So just pay attention to the following two points when using response.sendredirect: 1. When using Response.sendredirect, there is no HTML output in front. This is not absolute, can't have HTML output, but it does not have HTML to be sent to the browser. In fact, SERVER has a Cache mechanism, usually at 8K (I am JSP Server), which means that unless you shut down cache, or you use out.flush () forced refresh, then before using Sendredirect, There are small amounts of HTML outputs are also allowed. If an error is said, "some information has been Submitted" (original text forgot), then you have to pay attention, do you have too much HTML output in front. 2, after response.sendredirect, you should follow a Return; We already know that response.sendredirect is turned through a browser, so there is only actual actions only after the page processing is completed. Since you have already turned to turn, what is the significance of the post-output? And it is possible that the steering failure is caused by the back of the output. -------------------------------------------------- -------------------------------------------------- ---------------------------------------- First your response.sendredirect ("c ") may fail. I said that Sendredirect's parameters should contain the Context path section, so it should be changed to response.sendRedirect (). GetContextPath () "/c.jsp"). In addition, if the customer opened cookies, you can successfully get The properties in Session, Application. If you turn the cookie, change to Response.sendRedirect (Request.GetServletContext (). GetContextPath ()) can also access the properties. -------------------------------------------------- -------------------------------------------------- ----------------------------------------- Question of Response.sendRedirect () Chinese parameter in JSP Help: What is the problem about response.sendredirect () in JSP? ? ? I used the following sentence in JSP: response.sendredirect ("Test.jsp? Name = Name & PWD = 1111"); however, when getting parameters in Test.jsp, PWD can be obtained normally, and Name is garbled . Then I added it before this: response.setContentType ("text / html; charSet = GB2312"); I also tried some other solutions about Chinese garbled, all failed. Ask the expert guidance, thank you. Solve: string surl = "Test.jsp? Name = Name & PWD = 1111"; surl = new string (SURL.GETBYTES ("GBK"), "ISO8859_1"); response.sendredirect (surl); String surl = "Test.jsp? Name = Name & PWD = 1111"; surl = new string (SURL.GETBYTES ("GBK"), "ISO8859_1"); response.sendredirect (surl); String surl = "Test.jsp? Name = Name & PWD = 1111"; surl = new string (SURL.GETBYTES ("GBK"), "ISO8859_1"); response.sendredirect (surl);