刷新jsp页面 [英] refresh the jsp page

查看:79
本文介绍了刷新jsp页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,


您能告诉我如何在jsp中刷新网页.

解决方案

您可以使用页面的META属性.赞:-

 <   html  > ; 
<   HEAD  > 
<  标题 > 您的页面标题<  /title  > 
<      ="  刷新" 内容   2 ; url = URL到您的jsp页面"  >  <  > 
<   BODY  > 
此处为可选页面文字.
<  /BODY  > 
<  /HTML  >  <  /html  >  




其中

 content ="2; url =您的jsp页面的URL" 

中的2是要刷新的秒数,而url是您的jsp的地址.可以是同一页面,也可以是其他页面.


好吧,如果您每次会话只刷新一次页面,则可以使用

 <   html  > ; 
<  头部 > 
<  标题 > 您的页面标题<  /title  > 
<%
    如果( == session.getAttribute("  refreshCount");  refreshCount是您的属性在刷新之前检查
    {
        response.setHeader(" "  0"); //  0,可无延迟刷新
        session.getAttribute(" "  0");
    }
%>
<  正文 > 
此处为可选页面文字.
<  /body  > 
<  /head  >  <  /html  >  


除了这个元标记之外,还有其他诸如onload之类的东西.我想一次不刷新就刷新页面.


Hi friends,


Can you please tell me how to refresh a web page in jsp .

解决方案

You can use META attribute of page. Like:-

<html>
<HEAD>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="2;url=url to your jsp page"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML></html>




Where 2 in

content="2;url=url to your jsp page"

is delay of seconds to be refreshed and url is address of your jsp. it can be the same page or some other page.


Ok if you want to refresh the page only once per session then you can use

<html>
<head>
<title>Your Page Title</title>
<%
    if(null == session.getAttribute("refreshCount"); // refreshCount is your attribute to check before refresh
    {
        response.setHeader("REFRESH", "0");    // 0 for refresh without delay
        session.getAttribute("refreshCount", "0");
    }
%>
<body>
Optional page text here.
</body>
</head></html>


Except this meta tag any other thing is there like onload or any thing like that.I want to refresh the page once onload not every time.


这篇关于刷新jsp页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆