[ 文章导读 ] 总结下mate标签的作用:1、指定当前页面的编码<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">相当于在 dopost() / doget() 方法中设置request.setCharacterEncoding("utf-8");response.setContentType("text/html;charset=u ...
总结下mate标签的作用:
1、指定当前页面的编码 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 相当于在 dopost() / doget() 方法中设置 request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); 2、实现定时跳转 <!-- 使用meta标签实现重定向 --><meta http-equiv="refresh" content="5; url=http://localhost/demo/login.jsp" > content属性:
一般定时跳转都会结合js实现秒数的变化: <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www./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> 更多Java开发知识尽在优就业IT培训:http://www./ |
|