自動刷新/跳轉(zhuǎn)
//
在
Session
中存放計數(shù)器,體現(xiàn)刷新效果。
int
count = 0;
Object obj = request.getSession().getAttribute(
"count"
);
if
(obj ==
null
) {
??? count = 1;
}
try
{
??? count = 1 + Integer.parseInt(obj.toString());
}
catch
(Exception e) {}
request.getSession().setAttribute(
"count"
, count);
//
設(shè)置自動刷新,一秒鐘一次。
//response.setHeader("Refresh", "1");
//
設(shè)置自動跳轉(zhuǎn),一秒鐘一次。我寫的
url
是自己,所以和刷新一樣。
response.setHeader(
"Refresh"
,
"1,URL=refresh.do"
);
posted on 2006-10-19 12:15 白洋 閱讀(471) 評論(0) 編輯 收藏 所屬分類: Struts 知識點滴