1. 程式人生 > >response重定向的一點坑

response重定向的一點坑

charset har mit 錯誤 val utf text div oct

自己寫的提示錯誤,網上復制的就沒問題……檢查了一下一模一樣~

那就在這保存好正確的,以後留著用。

index頁面:

 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
 2     pageEncoding="UTF-8"%>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 4 <html>
 5 <head>
 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 7
<title>Insert title here</title> 8 </head> 9 <body> 10 11 <% 12 response.sendRedirect("login.jsp"); 13 %> 14 15 </body> 16 </html>

login頁面:

1 <%@ page language="java" contentType="text/html; charset=UTF-8"
2     pageEncoding="UTF-8"%>
3 
4 <form name="form1" method="post" method="post" action="">
5
用戶名:<input name="name" type="text" id="name" style="width:120px"><br> 6 密&nbsp;&nbsp;碼:<input name="pwd" type="password" id="pwd" style="width:120px"><br> 7 <br> 8 <input type = "submit" name="Submit" value="提交"> 9 </form>

response重定向的一點坑