File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jsp:forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:forward" Watch "jsp:forward" New topic
Author

jsp:forward

Rex Rock
Ranch Hand

Joined: Jun 25, 2001
Posts: 82
Hi people,
I have a form, where I collect details from user, if everything is fine, take him to a new page, thank him for submitting details.
I would like to take the user to another page,after displaying the thank you page for 2 seconds (say).
I tried <jsp:forward page="http://localhost:8080/newpage.jsp" />.
I get the following error,
java.io.IOException: Error: Attempt to clear a buffer that's already been flushed
Please shed some light here..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

You cannot forward once some output has been sent as part of the response. The best way to achieve what you are attempting is to either use the HTML meta tag to cause a redirect after your 2 seconds are up:
<META HTTP-EQUIV="Refresh" CONTENT="2; URL=whatever.jsp">
or to use a Javascript timeout to cause the redirect of you need more programmatic control.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: jsp:forward
 
Similar Threads
response.redirect and jsp:forward
Send parameters to an applet
forward & come back
[displayTag] how to open link in a new window?
Forwarding a request from a jsp to servlet or an html page