Please help me. It is very urgent. Here is my problem.
I have a jsp with multiple forms. I am placing one form in the div tag and hiding that. After certain period of time I have to show the hidden form as a popup for authentication(for security)asking the username and password. If we submit that popup form, it should be submitted and the corresponding response should be shown in the same popup.
But whats happening in my case is, i am able to see the popup after some time but when I click the SignIn button on the popup, the whole form (not the popup) is getting submitted and the main form is replaced by the result page.
How should I submit the popup form only. And one more thing is how can I lock the main form while the popup is open so that the user is not allowed to continue his transaction until he is authenticated once again.
First of all, please read this link and attempt to understand why it's never a good idea to put "very urgent" in a JavaRanch post.
Now, for your question: What you have created is not a "popup window". It's a trick I've played before with displaying and non-displaying parts of the page. Sometimes it's a good solution, but sometimes it isn't. In this case, where you want to submit a form from "the window" and have the form return to the window, I'd suggest you use a real popup window using the window.open() function. If you do this, any form submitted will return to the same window.
There is another problem with this approach, though: Since you're apparently opening the window as a result of a certain amount of time elapsing rather than by a direct action of the user, this popup window is likely to get blocked by the popup blocking software that many users have now.
If you want a "modal" dialaog box, meaning one that causes the original window to freeze and not be available until the dialog box is answered and closed, Microsoft Internet Explorer has a function called showModalDialog that creates this type of window. (See this link for information on this function in other browsers). It has a drawback as well, though: You can't submit a form from it and have it return to the same window. If you use this type of window, your best option is to use AJAX to communicate with the server and verify the user's credentials. If the user authenticates, simply close the dialog window and let the user continue with the applications.
For more information on showModalDialog, see this link.