File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Submit button affects meta-refresh! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Submit button affects meta-refresh!" Watch "Submit button affects meta-refresh!" New topic
Author

Submit button affects meta-refresh!

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
I have a frame where, when hitting the Submit button, the meta-refreshes increase in frequency.
There are three pages in the frame. Two of them have meta refreshes of 3 and 5 seconds respectively.
However, upon each Submit from the frame with no refresh, the audible number of refreshes increases. After about 20 submits, there are TONS of refreshes happening all the time.
This is a JSP page so I'm not sure if I need to do some kind of Javascript browser "document" refresh or if that will even work.
I'm really concerned what might be happening.
Also, each time I click the submit button, the bottom frame scrolls down a pixel or two.
Any ideas would be welcome!
Thanks.
-- Mike
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The reason for al of the refreshing is you are getting the meta tags stuck in a loop which can be a little tiny bug
if you want to manually refresh the page with JavaScript, all you need to do is just this
document.location.href=document.location.href;
it will cause the age to reload and it will act like the refresh has been hit.
Not sure if this answers your question, but it was a shot.

Eric
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
If I put code like this in the body section of my JSP, it won't load. I get a blank page.
<script type= "text/javascript">
<!--
document.location.href=document.location.href;
-->
Any ideas why? It seems to be the script tag.
Thanks much in advance.
-- Mike
Greg Schultz
Greenhorn

Joined: Oct 08, 2003
Posts: 16
Are you sure you only get a blank page? You are probably continually re-loading the page with that statement block. Try putting it in a function that gets called by your submit button.

Greg
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Yes, I took the code out that does the refresh.
I just left in the script expression with the same result.
Thanks.
-- Mike
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Is the timeout of the meta refresh on your two JSP pages dynamically determined ?

What exactly does your meta refresh tag look like the very first time you hit the frame page? How about after a single submit?

As for the bottom frame scrolling down, it's a JSP page.. are there any <br /> or spacing tags being used that might be dynamically determined? If you are incrementing a variable, thinking it is per request, but you have it scoped incorrectly, then perhaps it's doing some strange things. Is the actual source of the HTML different each time? Track down where in your source the extra HTML whitespace is coming from, and look there in your JSP.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Something else from your other post:

The name of the frame with the Submit button, in the lower third that scrolls down on each forward, is "ChatEntry.jsp". However, since it's contained in teh "mainframe" frame, I need to forward to the mainframe.jsp page.

I admit I've never done any heavy-duty frame programming, but I don't see the 'need' for this at all.

If your ChatEntry.jsp submits a form to a servlet, you stick the text into a database... why not just forward to ChatEntry.jsp again? The submitting frame will then re-appear, and you don't have to reload the ENTIRE frameset, rather, just the one frame.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Submit button affects meta-refresh!
 
Similar Threads
User session and refresh frames in jsp
Submit Button in JSP Page Scrolls Frame!
Java gurus please! Detecting browser close, Framesets, and Threads in Servlets
Menu applet refresh problem - please help
Long Running Servlet