2013年9月10日星期二

JAVA response is a little small problem .

<%@ 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">
<title>response使用说明</title>
</head>
<body>
<%!int count = 1; %>

<% response.setHeader("refresh", "2"); %>

<h3>你已经访问了页面 <%=count++ %>次</h3>
</body>
</html>


code shown above.
For response.setHeader ("refresh", "2");

I want to know , I directly through the browser to open this page.
of this code setHeader method settings , what will be passed to anyone ? Is passed from this page yourself ?
I do not see what is passed inside.
------ Solution ---------------------------------------- ----
jsp eventually compiled into a servlet, servlet will put this attribute meta refresh tag , the composition will write the final html to the browser .
------ Solution ---------------------------------------- ----
header is to the browser to see Oh, every request, response will consist of a header and a body

没有评论:

发表评论