You really can't do it in quite this way. The problem is that you must decide where the result is to be displayed
before you submit. You can't change your mind once the submit has already occurred.
I can think of work-around solution, though. There is a way to tell whether or not the current window is a popup window. If it is a popup window, the property window.opener will have a value other than null. Otherwise, it will be null.
In your error page in the body's onload event,
test window.opener to see if it's null. If it isn't null (meaning this is a popup window), cause the main window to load the error page (window.opener.location.replace('error.jsp');) and close the current window.
[ March 01, 2006: Message edited by: Merrill Higginson ]