Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-Refresh using JSP or ...

Status
Not open for further replies.

HoMyGod

Programmer
Jul 17, 2000
59
CH
Hello,

Does anybody know how to force a refresh on a HTML page? I know that there is a auto-refresh Meta Tag <META HTTP-EQUIV=&quot;refresh&quot; content=&quot;2;URL=http://www.yoursite.com/newpage.htm&quot;>

but the problem is that I don't want a cyclic refresh, but JUST ONE refresh when the page is downloaded...(I have added the no cache option!)

Maybe some function using JSP ?? I don't know...

Any help, please...
 
Try javascript and inresponse to onLod change document.location to the original address.

Good Luck
 
> I don't want a cyclic refresh, but JUST ONE refresh when the page is downloaded

So a client side script ONLY solution will not work.

> I have added the no cache option!

How? What do you mean &quot;added the option&quot;?

Is this the problem you are trying to solve, i.e., browsers caching old versions of a dynamic page?

> Does anybody know how to force a refresh on a HTML page?

There are many ways to accomplish this, but which one(s) will provide an appropriate solution to your problem? Need to know what the problem is to determine that!

&quot;But, that's just my opinion... I could be wrong&quot;.
-pete
 
Hi palbano,

I am trying to recover information in a html page. The informations came from a DB via JSP tags. The first time I am looking at the page, there is no data. I am pressing the refresh option in the toolbar of the browser and the data apear.

So, what I want is to automatize this action of pressing the refresh option. But as the data are editable directly in the web page, I can not use a cyclic refresh or it will erase all the modifications the user could have done...

I don't think that there is a spectial option in HTML to do that, so I would like to use some javascript to do that, but how?

Bye
 
I'm also trying to do the same thing and had no luck. If you were able to figure it out, or got some help, could you please let me know how you did it. I need the page to refresh onload only once, but not with time intervals.

Thanks
 
This could be done using javascript but I prefer server-side solution so try this...

In your Servlet/JSP:
1) On the first visit create a Session attribute called &quot;reload&quot; (or whatever) of type Boolean with a value of true if one does not already exist.

2) Check if the Session attribute &quot;reload&quot; is true.
- If true: add the following code to the page to cause it to refresh: <META HTTP-EQUIV=&quot;refresh&quot; content=&quot;0;&quot;>. Then and this is important set the Session attribute &quot;reload&quot; to false.
- If false: set &quot;reload&quot; to true but don't add the meta-tag to the HTML.

This should ensure that the page only reloads once. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top