• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

iframe and struts url won't work

 
pingkan paula
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i'm using iframe which targeting to a pop up window which intended to be a child of a main window.
However,the main window always redirect back to the child everytime i close the child window, my colleagues said that it because of the action url from struts being targeted in iframe.

This is the source

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that the problem is with the fact that you're using showModalDialog to open the window instead of window.open(). One of the quirks of showModalDialog is that you cannot submit a form from a window opened by this command and have the response return to the same window. The showModalDialog was intended to elicit a brief response and then close itself, returning the response to the main window. It was not intended for form submission.

In order to solve this problem, you have 2 choices: Use AJAX to get what you need from the server instead of a form submission or use window.open() to open the window instead of showModalDialog.

In my opinion, you're walking on dangerous ground by using showModalDialog anyway because it is not a cross-browser solution. One generally cannot assume that all clients to a website will be using Internet Explorer.
 
Arulanand Dayalan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Merrill said its not advisable to use Modal Dialog when your application is intended to be used on different browser. But if you sure your application would be viewed only in IE then there is an work around for your problem.

Try doing this,

window.name = "AnyName"
document.someForm.action="someaction.do";
document.someForm.method="post";
document.someForm.target="AnyName";
document.someForm.submit();

So the response would come to the same popup window.

Hope this helps.

Thanks and Regards,
Arul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic