Click here to Skip to main content
15,911,306 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi friends,


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

You can use META attribute of page. Like:-
HTML
<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
HTML
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.
 
Share this answer
 
Comments
komali Guntur 5-Sep-11 20:44pm    
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.
Ok if you want to refresh the page only once per session then you can use

HTML
<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>
 
Share this answer
 
v3
Comments
Ashish Tyagi 40 6-Sep-11 0:47am    
Tell me why you need to refresh the page, to get more accurate answer.
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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900