Helpful Information
 
 
Category: Java Help
REFRESH using servlets

I need a simple way to move to a generated page and have it REFRESHED - like using the 'refresh' button. I was given the following code and it doesn't work (though the guy who gave it to me swears it 'should'). The page is being output by a Java servlet.

"<input type=button value=Back onClick='.location.replace(sReferringPage)'>");

OR
//out.println("<input type=button value=Back onClick='.location.replace('URL')'>");

What's the EXACT syntax?

I get a 'page error' message when I run it in IE 5.5.
Any help would be greatly appreciated. It would be idea if I could capture the calling pages URL into a variable and use it rather than hardcoding the 'URL' portion of the method.

Any pointers to books that explain these seemingly tasks would be greatly appreciated.

You need this HTML:
<input type="button" value="Back" onClick="parent.location='mypage';">

Wrap that in an out.println(). An easy way to make sure it's not cached is to include the system time in the request:


out.println("<... onClick=\"parent.location='mypage?time="+System.currentTimeMillis()+"';\">");










privacy (GDPR)