This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Jsp Page Refresh  RSS feed

 
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.
 
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 ]
 
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 ]
 
Bartender
Posts: 20770
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • 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.
 
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 ]
 
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
 
Sheriff
Posts: 9099
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 ]
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!