總結下mate標籤的做用:javascript
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
至關於在 dopost() / doget() 方法中設置html
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
<!-- 使用meta標籤實現重定向 --> <meta http-equiv="refresh" content="5; url=http://localhost/demo/login.jsp" >
content屬性:java
通常定時跳轉都會結合js實現秒數的變化:jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- 使用meta標籤實現重定向 --> <meta http-equiv="refresh" content="5; url=http://localhost/day2/login.jsp" > <title>Insert title here</title> <script type="text/javascript"> //這個js實現了頁面顯示秒數的改變,具體的跳轉由meta標籤實現 var inner; window.onload = function(){ inner = window.setInterval("showTime()", 1000); } function showTime(){ var time = document.getElementById("time"); var timeValue = time.innerHTML; if(timeValue>0){ time.innerHTML -= 1; }else{ window.clearInterval(inner); } } </script> </head> <body> <span id="time">5</span>秒後跳轉到登陸頁面,如未跳轉,請點擊<a href="${pageContext.request.contextPath }/login.jsp">此處</a> </body> </html>
【未完待續…】post