• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jsp Page Refresh

 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to refresh a example.jsp page when
use <a href="example.jsp?param1=a"> point to
example.jsp. thanks.
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution to your problem is
1)If you want to refresh the page for every regular interval of time use the html tag given below in your jsp
<META http-equiv="REFRESH" content="60">
here for every 60 sec the page refreshed
2)Else use browser refresh button, when ever you want to refresh.
-arun
[ January 30, 2002: Message edited by: arun boraiah ]
 
Gabriel Fox
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,I am lost.
Why would U want to refresh a web-page repeatedly
after a said period, apart from if user for
instance makes a mistake while filling a form and needs to reset the form fields.Please,shed some
light on this.Cheers.
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Gabriel,
Auto refresh is required when the data displayed in the page varies with time.
example : On developing a live score card of some match say cricket match.
share price list. etc,
-arun
[ January 30, 2002: Message edited by: arun boraiah ]
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Auto refresh is also useful when the user has kicked off a background process that can't be completed before the browser times out. In this case, you keep feeding auto-refresh pages ("please wait") to the user until the actual output is ready to be displayed.
 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everybody!
It seems I solved this problem.I just need everytime when someone clike the link the page
will be refresh.
I added
<meta http-equiv="Cache-Control" content="no-cache" forua="true"/>
<meta http-equiv="pragma" content="no-cache">
but the first line didn't work, when I added
the second line it worked. I don't know why.
 
Steven Kors
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in servlets i use the following.
THis refers to HTTP version 1.0
response.setHeader("Pragma", "no-cache"); // HTTP 1.0
This refers to HTTP version 1.1
response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
Sooo if you make the leap...
THis refers to HTTP version 1.0
<meta http-equiv="pragma" content="no-cache">
THis refers to HTTP version 1.1
<meta http-equiv="Cache-Control" content="no-cache" forua="true"/>
I hope that helps you.

WIth reguard to setting a page refresh, i was wondering the following...
<%
//Refresh the page every 30 seconds automatically.
response.setHeader("Refresh","30");
%>
Why not use Java script?
[ January 31, 2002: Message edited by: Mercenary_Steel ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Mercenary_Steel"
Your name doesn't agree with the javaranch guidelines. Please take a moment and re-register after reviewing the guidelines at http://www.javaranch.com/name.jsp
thanks for your cooperation.
- satya
 
Steven Kors
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Testing
 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steven K very much.
I dont know how to do that with a javasript.
and I also have a problem write a jsp page to
download file. It always open the file directly.
Thanks
 
Marilyn de Queiroz
Sheriff
Posts: 9079
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
krussi,

Your name doesn't agree with the javaranch guidelines. Please take a moment and re-register after reviewing the guidelines at http://www.javaranch.com/name.jsp. We would like you to be able to continue to post here at JavaRanch.com
[ February 01, 2002: Message edited by: Marilyn deQueiroz ]
 
Steven Kors
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krussi,
If you want your page to refresh after set periods just put this into your JSP page.
<%
//Refresh the page every 30 seconds automatically.
response.setHeader("Refresh","30");
%>

With respect to cache control, i have not set thisin a JSP page before since i only put statice code in my JSP pages. I set these in my servlets;
response.setHeader("Pragma", "no-cache"); // HTTP 1.0
response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
I turn of caching if i am creating dynamic output and i dont want the Browser to pull from the local hardrive.
[ February 01, 2002: Message edited by: Steven K ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!